[PATCH v2 0/2] smb: client: don't use SMB2 responses that fail signature verification

From: Suyuan Wang via B4 Relay

Date: Sun Nov 15 2026 - 23:06:34 EST


v1 made smb2_check_receive() return the error when a response signature
doesn't verify. Sashiko pointed out that this isn't enough:
compound_send_recv() still passes the response buffer to the caller, and
smb2_compound_op() parses it anyway. It also found that
smb2_readv_callback() can drop the error when the read reaches EOF.

Patch 1 is v1 plus not passing the response on in compound_send_recv().
Patch 2 fixes the read path.

I tested this in QEMU (x86_64, next-20261109, PROVE_LOCKING on) against
Samba 4.15 with "server signing = mandatory", through a proxy that
changes responses without fixing the signature:

- EndOfFile in the QUERY_INFO response of the open/query/close compound
(stat): with v1 the forged size is copied into the open info, and stat
only shows the right size because the caller takes -EACCES for
STATUS_ACCESS_DENIED and opens the file again. With v2 stat fails with
EACCES.
- READ data, cache=none: without patch 2, cat prints the modified data.
With it, the read fails with EACCES.
- A file name in QUERY_DIRECTORY (the v1 test): still EACCES, and the
handle from the CREATE in that compound is closed ("Close unmatched
open").
- Without the proxy, stat, read, write, ls and rm work as before.

Enzo's point about SMB 3.1.1 tree connect responses is not covered here,
that can be a follow-up.

Changes in v2:
- Patch 1: also don't hand the response to the caller in
compound_send_recv() (Sashiko)
- Patch 2: new
- v1: https://lore.kernel.org/all/20261113-smb2-sign-v1-1-937ee7c20f08@xxxxxxxxx/

---
Suyuan Wang (2):
smb: client: fail SMB2 responses with a bad signature
smb: client: don't use read data that failed signature verification

fs/smb/client/smb2pdu.c | 2 ++
fs/smb/client/smb2transport.c | 6 +++++-
fs/smb/client/transport.c | 6 ++++++
3 files changed, 13 insertions(+), 1 deletion(-)