From: David Oberhollenzer Date: Wed, 17 May 2017 08:36:45 +0000 (+0200) Subject: ubifs: Fix data node size for truncating uncompressed nodes X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=59a74990f85bb372c9117e40c6cd27693b6df670;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git ubifs: Fix data node size for truncating uncompressed nodes 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 Signed-off-by: Richard Weinberger --- diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c index 294519b98874..f3b620cbdda4 100644 --- a/fs/ubifs/journal.c +++ b/fs/ubifs/journal.c @@ -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;