public inbox for linux-cifs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ksmbd: connection accounting and session teardown fixes
@ 2026-04-18 17:28 DaeMyung Kang
  2026-04-18 17:28 ` [PATCH 1/2] ksmbd: fix active_num_conn leak when alloc_transport() fails DaeMyung Kang
  2026-04-18 17:28 ` [PATCH 2/2] ksmbd: reset rcount per connection in ksmbd_conn_wait_idle_sess_id() DaeMyung Kang
  0 siblings, 2 replies; 5+ messages in thread
From: DaeMyung Kang @ 2026-04-18 17:28 UTC (permalink / raw)
  To: linkinjeon, smfrench
  Cc: senozhatsky, tom, linux-cifs, linux-kernel, stable,
	Henrique Carvalho, DaeMyung Kang

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-04-19  7:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-18 17:28 [PATCH 0/2] ksmbd: connection accounting and session teardown fixes DaeMyung Kang
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox