From: MIngyi Cong <congmingyi@gmail.com>
To: linkinjeon@kernel.org, senozhatsky@chromium.org,
sfrench@samba.org, tom@talpey.com
Cc: congmingyi@gmail.com, linux-kernel@vger.kernel.org,
linux-cifs@vger.kernel.org
Subject: [PATCH v3] fs: add the tuncate check of exfat
Date: Thu, 16 Mar 2023 22:35:02 +0800 [thread overview]
Message-ID: <20230316143502.7059-1-congmingyi@gmail.com> (raw)
In-Reply-To: <20230307135740.13209-1-congmingyi@gmail.com>
EXFAT will fill zero data in truncated range.
Fix this by adding EXFAT_SUPER_MAGIC check.
Signed-off-by: MIngyi Cong <congmingyi@gmail.com>
---
V1 -> V2: add the truncate check of hfs and remove EXFAT_SUPER_MAGIC in magic.h
V2 -> V3: remove the truncate check of hfs and hfsplus
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
next prev parent reply other threads:[~2023-03-16 14:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-04 8:35 [PATCH] fs: add the tuncate check of exfat and hfsplus MIngyi Cong
2023-03-07 9:38 ` Namjae Jeon
2023-03-28 13:13 ` [PATCH v3] fs: add the tuncate check of exfat Mingyi Cong
2023-03-28 23:54 ` Christoph Hellwig
2023-03-07 13:57 ` [PATCH v2] fs: add the tuncate check of hfs, exfat and hfsplus MIngyi Cong
2023-03-16 14:27 ` [PATCH v3] fs: add the tuncate check of exfat MIngyi Cong
2023-03-16 14:47 ` Christoph Hellwig
[not found] ` <CAABeQzW++EWfW1rKqqKJCDN5eTceVJ4r380SA6Dg99CRZtUKFw@mail.gmail.com>
2023-03-20 13:44 ` Christoph Hellwig
2023-03-16 14:35 ` MIngyi Cong [this message]
2023-03-16 14:45 ` MIngyi Cong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230316143502.7059-1-congmingyi@gmail.com \
--to=congmingyi@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=senozhatsky@chromium.org \
--cc=sfrench@samba.org \
--cc=tom@talpey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).