aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamjae Jeon <namjae.jeon@samsung.com>2020-06-04 08:05:31 +0900
committerNamjae Jeon <namjae.jeon@samsung.com>2020-06-09 16:50:07 +0900
commit29bbb14bfc80dd760b07d2be0a27e610562982e3 (patch)
tree750e7f135a9b5671e538f11b7e9863205f1df871
parentf341a7d8dcc4e3d01544d7bc145633f062ef6249 (diff)
downloadlinux-mmp-29bbb14bfc80dd760b07d2be0a27e610562982e3.tar.gz
exfat: fix incorrect update of stream entry in __exfat_truncate()
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>
-rw-r--r--fs/exfat/file.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/exfat/file.c b/fs/exfat/file.c
index 8e3f0eef45d773..fce03f31878735 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) {