From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796221555; b=B1q1+sXZWWpE/4bKhs9E8rFRghqZKccX4Tw9zpNhMU+SuryMF0EDf/DZqhVdB2brpeyE /p258mqrJtkURoj8fHEylAgkcbXZ+xLfea4BzDuJkhNJPLjdBKon+8gjBw07QOSiD1CJV DChMAV9tXi5DbXLcBHxRDhLWIt9+0446Pwk5vgKuK8ZvxjoZlbghslVy8bTMdpPnMHH17 ndiVkxlye1DFIFnk6P2SoaWOD5M9mC3lRx/RBJRYUaF0caCLF1ehYDKQA8Y0vYacxa3Sm 4QnwYyTsVtrIDXf1eQBFxGEMdYIfVwrW0QPxGCtWsF+ZX1XO1uQZkMLF8ciyGr38YiQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796221555; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=U3N4Oziw0is/sms5QYJ8MY/4vzeh13nBy2kNQqaXXAY=; b=HXKWGlziAY4odVYte3jePUfaYS7lKDMh9AnnwZWLrOPLM2tbMbxB/KLKlxfpN8Mf+PJc yic+wHZnjhFOfcpwXjd/BQakBcH0yNSjU9uG9eDX+9RNI65CMOLiTCnAegc9IsuHTFKDa CugbhKnHRvb/PuusuU8r4Pr0nPDkBrYsqlGm0GeCJUzxDAFzYII51LpmKGziObsbGNC7a 9HNL1Z03GQ3WF0wd8IBkGzkd5np4c/AxfrlLi+AgX0kdQEEqms360SIVSUbEhg1+1Vqw4 6LuinwmyJ8Fzll6VZ9qERYAsb5flST/a/nevd8/ZMtpMi1MbhEvdzTHrlDGWKtsc4hQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=0eVniy6i; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A36F606A325 for ; Wed, 2 Dec 2026 14:25:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=0eVniy6i Received: by smtp.kernel.org (Postfix) with ESMTPSA id 482C11F000C1; Wed, 2 Dec 2026 14:25:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796221554; bh=U3N4Oziw0is/sms5QYJ8MY/4vzeh13nBy2kNQqaXXAY=; h=Subject:To:Cc:From:Date; b=0eVniy6iFC65ApYoCvkoGGRvVdq3uBZo3RXdndBM3JjCEZHLFYc6BMXuZBRnY/ELU ZKJzjz3SNu9acH4wBwkOTX5867EGTvhIiqTyU/S0hzku2TmNx/88/XT5oGRsjsoQ7D 1b7gPfbX8x2ys9XO3clJO2EVLc5TRneTcbdWzi44= Subject: FAILED: patch "[PATCH] smb: client: fail SMB2 responses with a bad signature" failed to apply to 6.6-stable tree To: stevewong@hust.edu.cn,daniel.birtwhistle@gehealthcare.com,kaixuan.li@ntu.edu.sg,pc@manguebit.org Cc: From: Date: Wed, 02 Dec 2026 14:55:33 +0100 Message-ID: <2026120233-yearning-glare-104e@gregkh> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.6-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y git checkout FETCH_HEAD git cherry-pick -x 2a5bd7a2bbb787483cd69ecf099e2b591e3633b2 # git commit -s git send-email --to '' --in-reply-to '2026120233-yearning-glare-104e@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 2a5bd7a2bbb787483cd69ecf099e2b591e3633b2 Mon Sep 17 00:00:00 2001 From: Suyuan Wang Date: Mon, 16 Nov 2026 04:06:23 +0000 Subject: [PATCH] smb: client: fail SMB2 responses with a bad signature smb2_check_receive() checks the response signature when signing is on, but a failed check is only logged: rc = smb2_verify_signature(&rqst, server); if (rc) cifs_server_dbg(VFS, "SMB signature verification returned ...", rc); ... return map_smb2_to_linux_error(mid->resp_buf, log_error); The status from the response is returned as usual, and the caller goes on to use a response whose signature is wrong. This is the path for synchronous and compound requests and for smb2_writev_callback(). On a signed but unencrypted connection, anyone who can modify the traffic can change e.g. a directory listing or file attributes, and the client accepts it. Return the verification error instead. That alone is not enough for compound_send_recv(), which still hands the response buffer to the caller after check_receive() fails. smb2_compound_op() then maps the status from that buffer again and copies the payload out, and other callers look at the buffer on error too, e.g. smb2_open_file() parses a symlink target out of a STATUS_STOPPED_ON_SYMLINK response. So also mark the mid MID_RESPONSE_MALFORMED, and have compound_send_recv() handle it like a mid in a bad state: mark the earlier mids cancelled, so that a CREATE which did succeed gets its handle closed, and don't pass any response on. Unlike the SMB1 fix in commit dc96f01d54cc ("smb: client: terminate session upon failed client required signing"), don't reconnect: this runs in the thread that sent the request, and only cifsd should call cifs_reconnect(). And fail the request whichever side required signing, since a response with a bad signature can't be trusted either way. Found with a static analysis tool and checked by hand. Reported-by: Daniel Birtwhistle Closes: https://lore.kernel.org/linux-cifs/SN4PR22MB28883DAF57E0B4D4BFB1C22AEEC42@SN4PR22MB2888.namprd22.prod.outlook.com/ Fixes: 3c1bf7e48e9e ("CIFS: Enable signing in SMB2") Cc: stable@vger.kernel.org Co-developed-by: Kaixuan Li Signed-off-by: Kaixuan Li Signed-off-by: Suyuan Wang Signed-off-by: Paulo Alcantara diff --git a/fs/smb/client/smb2transport.c b/fs/smb/client/smb2transport.c index 080864b24a0c..c63d66b01bda 100644 --- a/fs/smb/client/smb2transport.c +++ b/fs/smb/client/smb2transport.c @@ -711,9 +711,12 @@ smb2_check_receive(struct mid_q_entry *mid, struct TCP_Server_Info *server, int rc; rc = smb2_verify_signature(&rqst, server); - if (rc) + if (rc) { cifs_server_dbg(VFS, "SMB signature verification returned error = %d\n", - rc); + rc); + mid->mid_state = MID_RESPONSE_MALFORMED; + return rc; + } } return map_smb2_to_linux_error(mid->resp_buf, log_error); diff --git a/fs/smb/client/transport.c b/fs/smb/client/transport.c index c51f99d7be4b..375b821ab3ea 100644 --- a/fs/smb/client/transport.c +++ b/fs/smb/client/transport.c @@ -1124,6 +1124,11 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, rc = server->ops->check_receive(mid[i], server, flags & CIFS_LOG_ERROR); + if (mid[i]->mid_state != MID_RESPONSE_READY) { + cifs_mark_compound_mids_cancelled(mid, i); + num_processed = 0; + goto out; + } num_processed = i + 1; }