]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ubifs: Fix data node size for truncating uncompressed nodes
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Wed, 17 May 2017 08:36:45 +0000 (10:36 +0200)
committerRichard Weinberger <richard@nod.at>
Fri, 14 Jul 2017 20:49:06 +0000 (22:49 +0200)
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: 7799953b34d1 ("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>
fs/ubifs/journal.c

index 294519b98874058ef7ac7e089361733adb9f26de..f3b620cbdda4c63947c774daab33e980efa42df8 100644 (file)
@@ -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;