ksmbd: clear DACL_PRESENT when the query omits the DACL
Subsystems (3)
PATCH 1/1 ksmbd: clear DACL_PRESENT when the query omits the DACL
build_sec_desc() starts the Control of a security query reply from SELF_RELATIVE and ORs in the Control of the stored descriptor. A stored descriptor with a DACL has DACL_PRESENT. When the client asks only for the owner or the group, the reply then has DACL_PRESENT set and no DACL. A client reads DACL_PRESENT with a zero DACL offset as a NULL DACL, not as a DACL that was left out of the reply. The server's own access checks are not affected.
Do not take DACL_PRESENT from the stored descriptor. build_sec_desc() already sets it when the DACL is requested.
---
Tested on ksmbd-for-next 267029b35ad1 with KASAN. On a file with a stored descriptor, a query for the owner, the group or both now returns Control 0x8000 instead of 0x8004. Replies for the other tested AdditionalInformation values are unchanged. smbtorture results match the base.
This patch was developed with LLM assistance.
fs/smb/server/smbacl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/smb/server/smbacl.c +2 -1
@@ -1077,8 +1077,9 @@ int build_sec_desc(const struct mnt_idmap *idmap, pntsd->sacloffset =0 ; pntsd->revision =cpu_to_le16 (1 ); pntsd->type =cpu_to_le16 (SELF_RELATIVE ); +/* DACL_PRESENT is set below when the DACL is requested */ if (ppntsd) - pntsd->type |= ppntsd->type; + pntsd->type |= ppntsd->type & ~cpu_to_le16 (DACL_PRESENT );if (addition_info &OWNER_SECINFO ) { pntsd->osidoffset =cpu_to_le32 (offset);
Signature · 1 line
2.47.3
Namjae Jeon
maintainerfs/smb/server/smbacl.c int build_sec_desc(const struct mnt_idmap *idmap, · line 1082
Quoted 8 lines
fs/smb/server/smbacl.c +2
-1@@ -1077,8 +1077,9 @@ int build_sec_desc(const struct mnt_idmap *idmap, pntsd->sacloffset =0 ; pntsd->revision =cpu_to_le16 (1 ); pntsd->type =cpu_to_le16 (SELF_RELATIVE ); +/* DACL_PRESENT is set below when the DACL is requested */ if (ppntsd) - pntsd->type |= ppntsd->type; + pntsd->type |= ppntsd->type & ~cpu_to_le16 (DACL_PRESENT );
ksmbd can set DACL_PROTECTED or DACL_AUTO_INHERITED as well as DACL_PRESENT. But this patch only removes DACL_PRESENT. Thanks.