From: DaeMyung Kang <charsyam@gmail.com>
To: linkinjeon@kernel.org, smfrench@gmail.com
Cc: senozhatsky@chromium.org, tom@talpey.com,
linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org,
Henrique Carvalho <henrique.carvalho@suse.com>,
DaeMyung Kang <charsyam@gmail.com>
Subject: [PATCH 0/2] ksmbd: connection accounting and session teardown fixes
Date: Sun, 19 Apr 2026 02:28:42 +0900 [thread overview]
Message-ID: <20260418172844.1333378-1-charsyam@gmail.com> (raw)
Two independent correctness fixes in the ksmbd server.
1/2 ksmbd_tcp_new_connection() does not decrement active_num_conn on
the alloc_transport() failure path, so repeated allocation
failures monotonically inflate the counter until max_connections
is reached and new clients are refused indefinitely. This is
the remaining half of the same family of accounting bugs
addressed by 77ffbcac4e56 ("smb: server: fix leak of
active_num_conn in ksmbd_tcp_new_connection()"), which only
closed the kthread_run() failure path. Reproduced under a debug
build that forces alloc_transport() to return NULL for a bounded
number of calls; details in the commit log.
2/2 ksmbd_conn_wait_idle_sess_id() stores its per-connection
threshold (rcount) in cross-iteration state, so whether a given
sibling connection is compared against the loose (< 2) or the
strict (< 1) threshold is decided by hash iteration order
relative to curr_conn. Connections visited after curr_conn can
slip through the idle check while still processing requests
against the same session, reopening the teardown race
destroy_previous_session() was meant to close. This is a
code-inspection fix; the iteration-order dependency makes a
targeted reproducer impractical.
The two patches are independent; the series order is not significant.
DaeMyung Kang (2):
ksmbd: fix active_num_conn leak when alloc_transport() fails
ksmbd: reset rcount per connection in ksmbd_conn_wait_idle_sess_id()
fs/smb/server/connection.c | 5 ++---
fs/smb/server/transport_tcp.c | 2 ++
2 files changed, 4 insertions(+), 3 deletions(-)
--
2.43.0
next reply other threads:[~2026-04-18 17:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-18 17:28 DaeMyung Kang [this message]
2026-04-18 17:28 ` [PATCH 1/2] ksmbd: fix active_num_conn leak when alloc_transport() fails DaeMyung Kang
2026-04-19 7:30 ` Namjae Jeon
2026-04-18 17:28 ` [PATCH 2/2] ksmbd: reset rcount per connection in ksmbd_conn_wait_idle_sess_id() DaeMyung Kang
2026-04-19 7:29 ` 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=20260418172844.1333378-1-charsyam@gmail.com \
--to=charsyam@gmail.com \
--cc=henrique.carvalho@suse.com \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=senozhatsky@chromium.org \
--cc=smfrench@gmail.com \
--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