Skip to content

Commit 29bbb14

Browse files
committed
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: 98d9170 ("exfat: add file operations") Cc: [email protected] # v5.7 Signed-off-by: Namjae Jeon <[email protected]>
1 parent f341a7d commit 29bbb14

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

fs/exfat/file.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,11 @@ int __exfat_truncate(struct inode *inode, loff_t new_size)
171171

172172
/* File size should be zero if there is no cluster allocated */
173173
if (ei->start_clu == EXFAT_EOF_CLUSTER) {
174-
ep->dentry.stream.valid_size = 0;
175-
ep->dentry.stream.size = 0;
174+
ep2->dentry.stream.valid_size = 0;
175+
ep2->dentry.stream.size = 0;
176176
} else {
177-
ep->dentry.stream.valid_size = cpu_to_le64(new_size);
178-
ep->dentry.stream.size = ep->dentry.stream.valid_size;
177+
ep2->dentry.stream.valid_size = cpu_to_le64(new_size);
178+
ep2->dentry.stream.size = ep->dentry.stream.valid_size;
179179
}
180180

181181
if (new_size == 0) {

0 commit comments

Comments
 (0)