[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230328131334.5572-1-congmingyi@gmail.com>
Date: Tue, 28 Mar 2023 21:13:34 +0800
From: Mingyi Cong <congmingyi@...il.com>
To: linkinjeon@...nel.org, senozhatsky@...omium.org, sfrench@...ba.org,
tom@...pey.com
Cc: congmingyi@...il.com, linux-kernel@...r.kernel.org,
linux-cifs@...r.kernel.org
Subject: [PATCH v3] fs: add the tuncate check of exfat
From: MIngyi Cong <congmingyi@...il.com>
EXFAT will fill zero data in truncated range.
Fix this by adding EXFAT_SUPER_MAGIC check.
Signed-off-by: MIngyi Cong <congmingyi@...il.com>
---
fs/ksmbd/smb2pdu.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
index 0685c1c77b9f..3f2e34936b8d 100644
--- a/fs/ksmbd/smb2pdu.c
+++ b/fs/ksmbd/smb2pdu.c
@@ -5746,7 +5746,8 @@ static int set_end_of_file_info(struct ksmbd_work *work, struct ksmbd_file *fp,
* truncate of some filesystem like FAT32 fill zero data in
* truncated range.
*/
- if (inode->i_sb->s_magic != MSDOS_SUPER_MAGIC) {
+ if (inode->i_sb->s_magic != MSDOS_SUPER_MAGIC ||
+ inode->i_sb->s_magic != EXFAT_SUPER_MAGIC) {
ksmbd_debug(SMB, "truncated to newsize %lld\n", newsize);
rc = ksmbd_vfs_truncate(work, fp, newsize);
if (rc) {
--
2.34.1
Powered by blists - more mailing lists