[PATCH v3 2/2] ksmbd: decode version 3 fields in ndr_decode_dos_attr()
From: koraynilay
Date: Sun Nov 15 2026 - 10:53:38 EST
When decoding a version 3 user.DOSATTRIB xattr, ndr_decode_dos_attr()
discards ea_size, size, alloc_size, and change_time into NULL. When the
xattr is subsequently rewritten, ndr_encode_dos_attr() writes zeros for
these fields, clobbering their existing values on disk.
Fix this by decoding ea_size, size, alloc_size, and change_time into
struct xattr_dos_attrib so their values are preserved.
Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
Cc: stable@xxxxxxxxxxxxxxx
Assisted-by: Gemini:3.8-flash-high antigravity-cli-1.5.7
Signed-off-by: koraynilay <koray.fra@xxxxxxxxx>
---
v3 changes:
- split out from v2;
fs/smb/server/ndr.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/smb/server/ndr.c b/fs/smb/server/ndr.c
index b5190528340f..1376d5a59fc8 100644
--- a/fs/smb/server/ndr.c
+++ b/fs/smb/server/ndr.c
@@ -271,15 +271,15 @@ int ndr_decode_dos_attr(struct ndr *n, struct xattr_dos_attrib *da)
ret = ndr_read_int64(n, &da->create_time);
} else {
- ret = ndr_read_int32(n, NULL);
+ ret = ndr_read_int32(n, &da->ea_size);
if (ret)
return ret;
- ret = ndr_read_int64(n, NULL);
+ ret = ndr_read_int64(n, &da->size);
if (ret)
return ret;
- ret = ndr_read_int64(n, NULL);
+ ret = ndr_read_int64(n, &da->alloc_size);
if (ret)
return ret;
@@ -287,7 +287,7 @@ int ndr_decode_dos_attr(struct ndr *n, struct xattr_dos_attrib *da)
if (ret)
return ret;
- ret = ndr_read_int64(n, NULL);
+ ret = ndr_read_int64(n, &da->change_time);
}
return ret;
--
2.56.0