Re: [PATCH 0/4] ksmbd: fix the checks on an open of an existing file

From: Namjae Jeon

Date: Mon Nov 30 2026 - 07:42:49 EST


On Mon, Nov 30, 2026 at 2:14 PM Ian Bridges <icb@xxxxxxxxxxxx> wrote:
>
> These patches fix four bugs in an open of an existing file.
>
> Patch 1 stops a delete-on-close open from deleting a read-only file on a
> share that does not store DOS attributes. Patch 2 fails an overwrite or
> supersede of a directory, which ksmbd lets succeed. Patch 3 fails an
> overwrite of a hidden or system file that leaves the attribute out,
> which ksmbd lets empty the file. Patch 4 refuses write access to a
> read-only file.
>
> Patch 1 adds the attribute read used by patches 3 and 4. Patch 2 adds
> the disposition check used by patch 3. The patches apply in the order
> shown.
>
> Tests
> =====
>
> I tested the series on ksmbd-for-next b572ec503ef0, on x86_64 with
> KASAN.
>
> - Each patch builds with W=1 and sparse. The series adds no smatch
> warning.
> - A script sent one request for each changed rule to the base and to
> the tree at each patch. Each request got the status that its patch
> describes. The requests that are not meant to change, POSIX opens
> among them, gave the same results as on the base.
> - smbtorture gives the same results at each patch as on the base.
> KASAN reported nothing.
>
> This series was developed with LLM assistance.
>
> Ian Bridges (4):
> ksmbd: check the cached read-only attribute for delete-on-close
> ksmbd: fail an overwrite or supersede of a directory
> ksmbd: fail an overwrite that would clear the hidden or system
> attribute
> ksmbd: refuse write access to a read-only file at open
Applied it to #ksmbd-for-next.
Thanks!