7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Namjae Jeon commit b4bae7af1154089be87c7475218264fcbfd16d10 upstream. The expiration worker holds conn_list_lock for reading while checking for authenticated sessions. Without this change, the check can wait for conn->session_lock or sessions_table_lock. In destroy_previous_session(), the status updates after ksmbd_conn_wait_idle_sess() run with both session locks held for writing. Both the KSMBD_SESS_GOOD error path and the KSMBD_SESS_NEED_SETUP success path call ksmbd_all_conn_set_status(), which takes conn_list_lock for reading. A writer queued on conn_list_lock can block these new read acquisitions. The worker then waits for a session lock held by destroy_previous_session(), which waits behind the writer. The writer cannot proceed until the worker releases conn_list_lock. Try both session locks instead of waiting in the scavenging check. Keep the connection when either lock is busy and let the periodic worker retry later. Fixes: d7fd1f98607f ("ksmbd: follow SMB2 session expiration semantics") Cc: stable@vger.kernel.org Reported-by: Abdifatah Suruur Signed-off-by: Namjae Jeon Signed-off-by: Greg Kroah-Hartman --- fs/smb/server/mgmt/user_session.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/fs/smb/server/mgmt/user_session.c +++ b/fs/smb/server/mgmt/user_session.c @@ -532,7 +532,12 @@ bool ksmbd_conn_has_valid_or_expired_ses int state, bkt; bool found = false; - down_read(&conn->session_lock); + /* + * The expiration worker holds conn_list_lock, which session teardown + * takes after the session locks. Defer scavenging if either is busy. + */ + if (!down_read_trylock(&conn->session_lock)) + return true; xa_for_each(&conn->sessions, id, sess) { state = READ_ONCE(sess->state); if (state == SMB2_SESSION_VALID || @@ -546,7 +551,8 @@ bool ksmbd_conn_has_valid_or_expired_ses return true; /* A session bound through SMB3 multichannel is not in conn->sessions. */ - down_read(&sessions_table_lock); + if (!down_read_trylock(&sessions_table_lock)) + return true; hash_for_each(sessions_table, bkt, sess, hlist) { state = READ_ONCE(sess->state); if (state != SMB2_SESSION_VALID &&