mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ian Bridges <icb@fastmail.org>
To: linkinjeon@kernel.org
Cc: senozhatsky@chromium.org, tom@talpey.com,
	chenxiaosong@chenxiaosong.com, linux-cifs@vger.kernel.org,
	linux-kernel@vger.kernel.org, Ian Bridges <icb@fastmail.org>
Subject: [PATCH 0/4] ksmbd: fix the checks on an open of an existing file
Date: Sun, 29 Nov 2026 23:13:45 -0600	[thread overview]
Message-ID: <cover.1796015315.git.icb@fastmail.org> (raw)

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

 fs/smb/server/smb2pdu.c   | 131 +++++++++++++++++++++++++++++++-------
 fs/smb/server/vfs_cache.c |  23 +++++++
 fs/smb/server/vfs_cache.h |   1 +
 3 files changed, 133 insertions(+), 22 deletions(-)


base-commit: b572ec503ef0c9dc74507b4a624df7f218da6a64
-- 
2.47.3


             reply	other threads:[~2026-11-30  5:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  5:13 Ian Bridges [this message]
2026-11-30  5:13 ` [PATCH 1/4] ksmbd: check the cached read-only attribute for delete-on-close Ian Bridges
2026-11-30  5:13 ` [PATCH 2/4] ksmbd: fail an overwrite or supersede of a directory Ian Bridges
2026-11-30  5:13 ` [PATCH 3/4] ksmbd: fail an overwrite that would clear the hidden or system attribute Ian Bridges
2026-11-30  5:13 ` [PATCH 4/4] ksmbd: refuse write access to a read-only file at open Ian Bridges

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1796015315.git.icb@fastmail.org \
    --to=icb@fastmail.org \
    --cc=chenxiaosong@chenxiaosong.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=tom@talpey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®