Skip to content

Commit

Permalink
ubifs: Fix data node size for truncating uncompressed nodes
Browse files Browse the repository at this point in the history
Currently, the function truncate_data_node only updates the
destination data node size if compression is used. For
uncompressed nodes, the old length is incorrectly retained.

This patch makes sure that the length is correctly set when
compression is disabled.

Fixes: 7799953 ("ubifs: Implement encrypt/decrypt for all IO")
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
  • Loading branch information
David Oberhollenzer authored and Richard Weinberger committed Jul 14, 2017
1 parent f34e87f commit 59a7499
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/ubifs/journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1298,7 +1298,9 @@ static int truncate_data_node(const struct ubifs_info *c, const struct inode *in
goto out;
}

if (compr_type != UBIFS_COMPR_NONE) {
if (compr_type == UBIFS_COMPR_NONE) {
out_len = *new_len;
} else {
err = ubifs_decompress(c, &dn->data, dlen, buf, &out_len, compr_type);
if (err)
goto out;
Expand Down

0 comments on commit 59a7499

Please sign in to comment.