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>,
stable@vger.kernel.org
Subject: [PATCH v2 2/2] ksmbd: skip metadata-only stream opens in the delete check
Date: Thu, 5 Nov 2026 21:53:45 -0600 [thread overview]
Message-ID: <20261106035345.728454-3-icb@fastmail.org> (raw)
In-Reply-To: <20261106035345.728454-1-icb@fastmail.org>
A metadata-only named-stream open without FILE_SHARE_DELETE blocks a
later DELETE open of the file. It also blocks setting the file delete
pending.
Ignore a stream open unless its effective access includes data, execute
or delete access. Reuse the sharing-access helper so overwriting a
stream, or creating one on an existing file, still counts as
FILE_WRITE_DATA. The Time Machine AFP_AfpInfo synthesis keeps only its
requested access.
Fixes: 19043971c947 ("ksmbd: honor stream delete sharing for base file")
Cc: stable@vger.kernel.org
Signed-off-by: Ian Bridges <icb@fastmail.org>
---
Notes:
This affects shares that use "vfs objects = streams_xattr".
Tested on ksmbd-for-next 957772008502 with KASAN. Targeted stream tests
and a KUnit matrix covered metadata-only, create and overwrite cases.
smbtorture matched the base. There were no KASAN reports or warnings.
A reproducer is available on request.
This fix was developed with LLM assistance.
fs/smb/server/vfs_cache.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/smb/server/vfs_cache.c b/fs/smb/server/vfs_cache.c
index f9079c529d07..c846023e5ada 100644
--- a/fs/smb/server/vfs_cache.c
+++ b/fs/smb/server/vfs_cache.c
@@ -420,7 +420,12 @@ bool ksmbd_has_stream_without_delete_share(struct ksmbd_file *fp)
if (file_inode(fp->filp) != file_inode(prev_fp->filp))
continue;
- if (!(prev_fp->saccess & FILE_SHARE_DELETE_LE)) {
+ /*
+ * A stream open with no right in FILE_SHARE_CHECKED_ACCESS_LE,
+ * implied writes included, never conflicts.
+ */
+ if (!(prev_fp->saccess & FILE_SHARE_DELETE_LE) &&
+ ksmbd_sharing_daccess(prev_fp) & FILE_SHARE_CHECKED_ACCESS_LE) {
ret = true;
break;
}
--
2.47.3
next prev parent reply other threads:[~2026-11-06 3:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 3:53 [PATCH v2 0/2] ksmbd: exclude metadata-only opens from sharing checks Ian Bridges
2026-11-06 3:53 ` [PATCH v2 1/2] ksmbd: skip metadata-only opens in " Ian Bridges
2026-11-06 3:53 ` Ian Bridges [this message]
2026-11-06 10:45 ` [PATCH v2 0/2] ksmbd: exclude metadata-only opens from " Namjae Jeon
2026-11-06 12:13 ` 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=20261106035345.728454-3-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=stable@vger.kernel.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®