From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754057AbdEQIhC (ORCPT ); Wed, 17 May 2017 04:37:02 -0400 Received: from mail.sigma-star.at ([95.130.255.111]:45997 "EHLO mail.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752300AbdEQIg5 (ORCPT ); Wed, 17 May 2017 04:36:57 -0400 From: Richard Weinberger To: linux-mtd@lists.infradead.org Cc: linux-kernel@vger.kernel.org, David Oberhollenzer , Richard Weinberger Subject: [PATCH 2/6] ubifs: Fix data node size for truncating uncompressed nodes Date: Wed, 17 May 2017 10:36:45 +0200 Message-Id: <20170517083649.25135-2-richard@nod.at> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170517083649.25135-1-richard@nod.at> References: <20170517083649.25135-1-richard@nod.at> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Oberhollenzer 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 --- fs/ubifs/journal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; -- 2.12.0