summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGael Blivet <gael.blivet@gmail.com>2026-07-09 02:01:09 +0200
committerNamjae Jeon <linkinjeon@kernel.org>2026-08-17 15:00:40 +0900
commit439a472cb4fa5df77d595e37205115c01d887d95 (patch)
treef4abdf36cd73ea915b904df256c8e62ea283742f
parent5838cfd6111ae5abe842babf194c54cd3b719f92 (diff)
ksmbd: zero-initialize xattr_dos_attrib in smb2_update_xattrs()
ndr_decode_dos_attr() only populates da->itime for version-4 DOS attribute xattrs; for version 3 it's skipped entirely (only da->create_time is set). smb2_update_xattrs() declared da without initializing it, so fp->itime = da.itime unconditionally copies whatever was on the kernel stack for any file carrying a version-3 xattr (e.g. written by an older client or server) -- uninitialized stack memory that can later be exposed to a client via QUERY_INFO. Zero-initialize da at declaration, matching the pattern fsctl_set_sparse() already uses in this same file. Assisted-by: Claude:claude-sonnet-5 Signed-off-by: Gael Blivet <gael.blivet@gmail.com> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
-rw-r--r--fs/smb/server/smb2pdu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index f02520f54c6f..1cb570bbde8a 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -2984,7 +2984,7 @@ out:
static void smb2_update_xattrs(struct ksmbd_tree_connect *tcon,
const struct path *path, struct ksmbd_file *fp)
{
- struct xattr_dos_attrib da;
+ struct xattr_dos_attrib da = {};
bool store_dos_attrs = test_share_config_flag(tcon->share_conf,
KSMBD_SHARE_FLAG_STORE_DOS_ATTRS);
int rc;