From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DBCC83FAE08; Tue, 31 Mar 2026 16:28:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774974482; cv=none; b=afeR3WkfcwCIoLKD5mCj0raVQklhq7CMVfpDxL/y7nusi0ZZ3OCPGjj3jCrpQCKrxR6wklyxIwhv4ndMSGdVwENuPU19cTf56KgIc4QIeNroe/j+//dYPV52EkUIxyZJ02r9qhB6AMTge844DTe8y/S8OFylLJVGvFvQlRbJytA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774974482; c=relaxed/simple; bh=Y/Br69wAU1hEw5wRzenLV6NEq2hdF2xGM81cboa7EoE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=p0gvyR/jiB85lZwk+1e7SpyxLhYlH5Xi8P21nzpIzOZ1SdykQG5dW6j8J+6c2SwPPgD7HtiV6IlkEZF1foTi7qBDwMj/aY85FaQWQ4hIGBkazmJZK6k3VO/wQIAeUxtECxZKGsbZv4/qd19S+NbD/YNmoK8fM/d1GwckFyHDsj8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=zfhys4cl; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="zfhys4cl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69FADC19423; Tue, 31 Mar 2026 16:28:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774974482; bh=Y/Br69wAU1hEw5wRzenLV6NEq2hdF2xGM81cboa7EoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zfhys4clm6epjhCx5XKkipC/Qgd42e9DUsXzrEXy3m6dVLfCIh9WQ5XItV2jIqZAa FudpPnpYy4iK744++C8JTDGRHNWNIqvYnrPf42ypn09i/RbAvVvh0fdfwbYAd5Vnwd BA7CDJ9JSQzf1pMgvXo4e3486yhONf2q6ZRm4Gsw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Hyunwoo Kim , Namjae Jeon , Steve French Subject: [PATCH 6.6 102/175] ksmbd: do not expire session on binding failure Date: Tue, 31 Mar 2026 18:21:26 +0200 Message-ID: <20260331161733.525448020@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260331161729.779738837@linuxfoundation.org> References: <20260331161729.779738837@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hyunwoo Kim commit 9bbb19d21ded7d78645506f20d8c44895e3d0fb9 upstream. When a multichannel session binding request fails (e.g. wrong password), the error path unconditionally sets sess->state = SMB2_SESSION_EXPIRED. However, during binding, sess points to the target session looked up via ksmbd_session_lookup_slowpath() -- which belongs to another connection's user. This allows a remote attacker to invalidate any active session by simply sending a binding request with a wrong password (DoS). Fix this by skipping session expiration when the failed request was a binding attempt, since the session does not belong to the current connection. The reference taken by ksmbd_session_lookup_slowpath() is still correctly released via ksmbd_user_session_put(). Cc: stable@vger.kernel.org Signed-off-by: Hyunwoo Kim Acked-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/smb/server/smb2pdu.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/fs/smb/server/smb2pdu.c +++ b/fs/smb/server/smb2pdu.c @@ -1925,8 +1925,14 @@ out_err: if (sess->user && sess->user->flags & KSMBD_USER_FLAG_DELAY_SESSION) try_delay = true; - sess->last_active = jiffies; - sess->state = SMB2_SESSION_EXPIRED; + /* + * For binding requests, session belongs to another + * connection. Do not expire it. + */ + if (!(req->Flags & SMB2_SESSION_REQ_FLAG_BINDING)) { + sess->last_active = jiffies; + sess->state = SMB2_SESSION_EXPIRED; + } ksmbd_user_session_put(sess); work->sess = NULL; if (try_delay) {