|
Kmods SIG |
50e2b3 |
From 29bbb14bfc80dd760b07d2be0a27e610562982e3 Mon Sep 17 00:00:00 2001
|
|
Kmods SIG |
50e2b3 |
From: Namjae Jeon <namjae.jeon@samsung.com>
|
|
Kmods SIG |
50e2b3 |
Date: Thu, 4 Jun 2020 08:05:31 +0900
|
|
Kmods SIG |
50e2b3 |
Subject: [Backport 29bbb14bfc80] exfat: fix incorrect update of stream entry
|
|
Kmods SIG |
50e2b3 |
in __exfat_truncate()
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
At truncate, there is a problem of incorrect updating in the file entry
|
|
Kmods SIG |
50e2b3 |
pointer instead of stream entry. This will cause the problem of
|
|
Kmods SIG |
50e2b3 |
overwriting the time field of the file entry to new_size. Fix it to
|
|
Kmods SIG |
50e2b3 |
update stream entry.
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
Fixes: 98d917047e8b ("exfat: add file operations")
|
|
Kmods SIG |
50e2b3 |
Cc: stable@vger.kernel.org # v5.7
|
|
Kmods SIG |
50e2b3 |
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
|
|
Kmods SIG |
50e2b3 |
---
|
|
Kmods SIG |
50e2b3 |
src/file.c | 8 ++++----
|
|
Kmods SIG |
50e2b3 |
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
diff --git a/src/file.c b/src/file.c
|
|
Kmods SIG |
50e2b3 |
index 8e3f0eef45d77345e6f57ef58f3e86c51c69e905..fce03f31878735e1fa389231abc1052f24447146 100644
|
|
Kmods SIG |
50e2b3 |
--- a/src/file.c
|
|
Kmods SIG |
50e2b3 |
+++ b/src/file.c
|
|
Kmods SIG |
50e2b3 |
@@ -171,11 +171,11 @@ int __exfat_truncate(struct inode *inode, loff_t new_size)
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
/* File size should be zero if there is no cluster allocated */
|
|
Kmods SIG |
50e2b3 |
if (ei->start_clu == EXFAT_EOF_CLUSTER) {
|
|
Kmods SIG |
50e2b3 |
- ep->dentry.stream.valid_size = 0;
|
|
Kmods SIG |
50e2b3 |
- ep->dentry.stream.size = 0;
|
|
Kmods SIG |
50e2b3 |
+ ep2->dentry.stream.valid_size = 0;
|
|
Kmods SIG |
50e2b3 |
+ ep2->dentry.stream.size = 0;
|
|
Kmods SIG |
50e2b3 |
} else {
|
|
Kmods SIG |
50e2b3 |
- ep->dentry.stream.valid_size = cpu_to_le64(new_size);
|
|
Kmods SIG |
50e2b3 |
- ep->dentry.stream.size = ep->dentry.stream.valid_size;
|
|
Kmods SIG |
50e2b3 |
+ ep2->dentry.stream.valid_size = cpu_to_le64(new_size);
|
|
Kmods SIG |
50e2b3 |
+ ep2->dentry.stream.size = ep->dentry.stream.valid_size;
|
|
Kmods SIG |
50e2b3 |
}
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
if (new_size == 0) {
|
|
Kmods SIG |
50e2b3 |
--
|
|
Kmods SIG |
50e2b3 |
2.31.1
|
|
Kmods SIG |
50e2b3 |
|