All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] exfat: fix incorrect update of stream entry in __exfat_truncate()
       [not found] <CGME20200603233258epcas1p3b17bdc6c4f8df1089693eebaf1124d0a@epcas1p3.samsung.com>
@ 2020-06-03 23:28 ` Namjae Jeon
  0 siblings, 0 replies; only message in thread
From: Namjae Jeon @ 2020-06-03 23:28 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, sj1557.seo, Namjae Jeon, stable

At truncate, there is a problem of incorrect updating in the file entry
pointer instead of stream entry. This will cause the problem of
overwriting the time field of the file entry to new_size. Fix it to
update stream entry.

Fixes: 98d917047e8b ("exfat: add file operations")
Cc: stable@vger.kernel.org # v5.7
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
---
 fs/exfat/file.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/exfat/file.c b/fs/exfat/file.c
index 8e3f0eef45d7..fce03f318787 100644
--- a/fs/exfat/file.c
+++ b/fs/exfat/file.c
@@ -171,11 +171,11 @@ int __exfat_truncate(struct inode *inode, loff_t new_size)
 
 		/* File size should be zero if there is no cluster allocated */
 		if (ei->start_clu == EXFAT_EOF_CLUSTER) {
-			ep->dentry.stream.valid_size = 0;
-			ep->dentry.stream.size = 0;
+			ep2->dentry.stream.valid_size = 0;
+			ep2->dentry.stream.size = 0;
 		} else {
-			ep->dentry.stream.valid_size = cpu_to_le64(new_size);
-			ep->dentry.stream.size = ep->dentry.stream.valid_size;
+			ep2->dentry.stream.valid_size = cpu_to_le64(new_size);
+			ep2->dentry.stream.size = ep->dentry.stream.valid_size;
 		}
 
 		if (new_size == 0) {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-03 23:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20200603233258epcas1p3b17bdc6c4f8df1089693eebaf1124d0a@epcas1p3.samsung.com>
2020-06-03 23:28 ` [PATCH] exfat: fix incorrect update of stream entry in __exfat_truncate() Namjae Jeon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.