Re: [PATCH] ksmbd: build an inherited security descriptor with its own offsets

From: Namjae Jeon

Date: Thu Nov 19 2026 - 06:37:34 EST


On Thu, Nov 19, 2026 at 4:35 PM Ian Bridges <icb@xxxxxxxxxxxx> wrote:
>
> A new file or directory can lose the access rules it should inherit from
> its parent. smb_inherit_dacl() sizes the child's descriptor for its SIDs
> and inherited ACEs but copies the parent's offsets. The owner and group
> SIDs keep their sizes, while the child's DACL can be smaller or larger.
> The parent's offsets may therefore be wrong for the child.
>
> ksmbd preserves the component order sent by the client. The Linux
> cifs client puts the DACL before the owner and group SIDs, so their
> offsets depend on the parent's DACL size. If the child's DACL is
> smaller, the copied SID offsets can fall outside the allocation.
> ksmbd then uses a default descriptor, losing inherited deny ACEs.
> If the child's DACL is larger, it can overwrite the SIDs.
>
> Build the child in owner, group, DACL order and calculate each offset
> as its component is copied. These writes exactly fill the allocation,
> so the checks on the copied parent offsets are no longer needed.
>
> Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Ian Bridges <icb@xxxxxxxxxxxx>
Applied it to #ksmbd-for-next.
Thanks!