Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1643136

[PATCH 2/6] ubifs: Fix data node size for truncating uncompressed nodes

From Richard Weinberger <richard@nod.at>
Newsgroups linux.kernel
Subject [PATCH 2/6] ubifs: Fix data node size for truncating uncompressed nodes
Date 2017-05-17 10:40 +0200
Message-ID <tI2EX-J3-47@gated-at.bofh.it> (permalink)
References <tI2EW-J3-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: David Oberhollenzer <david.oberhollenzer@sigma-star.at>

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 | 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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/6] ubifs: Don't try to encrypt special files Richard Weinberger <richard@nod.at> - 2017-05-17 10:40 +0200
  [PATCH 2/6] ubifs: Fix data node size for truncating uncompressed nodes Richard Weinberger <richard@nod.at> - 2017-05-17 10:40 +0200
  [PATCH 6/6] ubifs: Remove dead code from ubifs_get_link() Richard Weinberger <richard@nod.at> - 2017-05-17 10:40 +0200
  [PATCH 3/6] ubifs: Fix unlink code wrt. double hash lookups Richard Weinberger <richard@nod.at> - 2017-05-17 10:50 +0200

csiph-web