From: ZhangGuoDong <zhang.guodong@linux.dev>
To: smfrench@gmail.com, linkinjeon@kernel.org, pc@manguebit.org,
ronniesahlberg@gmail.com, sprasad@microsoft.com, tom@talpey.com,
bharathsm@microsoft.com, senozhatsky@chromium.org,
dhowells@redhat.com, metze@samba.org
Cc: linux-cifs@vger.kernel.org,
ZhangGuoDong <zhangguodong@kylinos.cn>,
ChenXiaoSong <chenxiaosong@kylinos.cn>
Subject: [PATCH 6/6] smb/server: preserve error status in smb2_handle_negotiate()
Date: Fri, 31 Jul 2026 11:50:08 +0000 [thread overview]
Message-ID: <20260731115008.111211-7-zhang.guodong@linux.dev> (raw)
In-Reply-To: <20260731115008.111211-1-zhang.guodong@linux.dev>
From: ZhangGuoDong <zhangguodong@kylinos.cn>
smb2_handle_negotiate() records specific failures such as
STATUS_INVALID_PARAMETER or STATUS_NOT_SUPPORTED.
Fixes: e2b76ab8b5c9 ("ksmbd: add support for read compound")
Signed-off-by: ZhangGuoDong <zhangguodong@kylinos.cn>
Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
---
fs/smb/server/smb2pdu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index 4bde5ab2c881..9b64e28b5d56 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -1722,7 +1722,7 @@ int smb2_handle_negotiate(struct ksmbd_work *work)
KSMBD_DEFAULT_GFP);
if (!conn->preauth_info) {
rc = -ENOMEM;
- rsp->hdr.Status = STATUS_INVALID_PARAMETER;
+ rsp->hdr.Status = STATUS_INSUFFICIENT_RESOURCES;
goto err_out;
}
@@ -1817,7 +1817,7 @@ int smb2_handle_negotiate(struct ksmbd_work *work)
ksmbd_conn_set_need_setup(conn);
err_out:
- if (rc)
+ if (rc && rsp->hdr.Status == STATUS_SUCCESS)
rsp->hdr.Status = STATUS_INSUFFICIENT_RESOURCES;
if (!rc)
--
2.54.0
next prev parent reply other threads:[~2026-07-31 11:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 11:50 [PATCH 0/6] ksmbd: fix some bugs ZhangGuoDong
2026-07-31 11:50 ` [PATCH 1/6] smb/server: fix null-ptr-deref in ksmbd_ipc_tree_connect_request() ZhangGuoDong
2026-07-31 11:50 ` [PATCH 2/6] smb/server: fix memory leak in ksmbd_vfs_set_durable_owner() ZhangGuoDong
2026-07-31 11:50 ` [PATCH 3/6] smb/server: fix invalid pointer dereference in ksmbd_stop_durable_scavenger() ZhangGuoDong
2026-07-31 11:50 ` [PATCH 4/6] smb/server: abort initialization when proc setup fails ZhangGuoDong
2026-07-31 11:50 ` [PATCH 5/6] smb/server: call ksmbd_proc_cleanup() on module init failure ZhangGuoDong
2026-07-31 11:50 ` ZhangGuoDong [this message]
2026-08-01 2:10 ` [PATCH 0/6] ksmbd: fix some bugs Namjae Jeon
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=20260731115008.111211-7-zhang.guodong@linux.dev \
--to=zhang.guodong@linux.dev \
--cc=bharathsm@microsoft.com \
--cc=chenxiaosong@kylinos.cn \
--cc=dhowells@redhat.com \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=metze@samba.org \
--cc=pc@manguebit.org \
--cc=ronniesahlberg@gmail.com \
--cc=senozhatsky@chromium.org \
--cc=smfrench@gmail.com \
--cc=sprasad@microsoft.com \
--cc=tom@talpey.com \
--cc=zhangguodong@kylinos.cn \
/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