* [PATCH] ksmbd: don't create a missing stream for FILE_OVERWRITE
@ 2026-11-28 0:39 Ian Bridges
0 siblings, 0 replies; only message in thread
From: Ian Bridges @ 2026-11-28 0:39 UTC (permalink / raw)
To: linkinjeon
Cc: senozhatsky, tom, chenxiaosong, linux-cifs, linux-kernel, Ian Bridges
An open of a named stream that does not exist fails with
STATUS_OBJECT_NAME_NOT_FOUND only for FILE_OPEN. With FILE_OVERWRITE
the stream is created and the open succeeds. MS-FSA 2.1.5.1.2 fails
both dispositions when the stream is not found. Fail FILE_OVERWRITE the
same way. FILE_OVERWRITE_IF still creates the stream.
Signed-off-by: Ian Bridges <icb@fastmail.org>
---
Tested on ksmbd-for-next b9eab18ab72e with KASAN. A FILE_OVERWRITE open
of a missing named stream now fails with STATUS_OBJECT_NAME_NOT_FOUND,
and no stream is created. FILE_OVERWRITE of an existing stream and
FILE_OVERWRITE_IF of a missing one still succeed. smbtorture gives the
same results as on the base.
This patch was developed with LLM assistance.
fs/smb/server/smb2pdu.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index f286f9818643..e073b96d92a6 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -3747,6 +3747,10 @@ static noinline int smb2_set_stream_name_xattr(const struct path *path,
return -EBADF;
}
+ /* FILE_OVERWRITE does not create a missing stream (MS-FSA 2.1.5.1.2) */
+ if (fp->cdoption == FILE_OVERWRITE_LE)
+ return -EBADF;
+
if (!test_tree_conn_flag(fp->tcon, KSMBD_TREE_CONN_FLAG_WRITABLE))
return -EACCES;
base-commit: b9eab18ab72ec25abf431cba58e5239f695632f7
--
2.47.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-28 0:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-28 0:39 [PATCH] ksmbd: don't create a missing stream for FILE_OVERWRITE Ian Bridges
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®