CVE-2026-64387: smb: client: fix query directory replay double-free

Greg Kroah-Hartman <[email protected]> Sat, 25 Jul 2026 10:50:04 +0200
Newsgroups org.kernel.vger.linux-cve-announce
Message-ID <2026072526-CVE-2026-64387-ff1a@gregkh>
From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

smb: client: fix query directory replay double-free

A response-bearing attempt can return a replayable error and free its
response buffer. If SMB2_query_directory_init() fails before the next send,
cleanup retains the previous buffer type and frees that response again.

Reset response bookkeeping before each attempt to prevent the stale free.

The Linux kernel CVE team has assigned CVE-2026-64387 to this issue.


Affected and fixed versions
===========================

	Issue introduced in 6.6.32 with commit 433042a91f9373241307725b52de573933ffedbf and fixed in 6.6.145 with commit 3409aedf3c81a810243da94164f6621c9d205c98
	Issue introduced in 6.8 with commit 4f1fffa2376922f3d1d506e49c0fd445b023a28e and fixed in 6.12.96 with commit 1665f25b1dea30bf2d02e16245d203a944c9d994
	Issue introduced in 6.8 with commit 4f1fffa2376922f3d1d506e49c0fd445b023a28e and fixed in 6.18.39 with commit 00b0fa425941438b664950a8ee65dfba2def4336
	Issue introduced in 6.8 with commit 4f1fffa2376922f3d1d506e49c0fd445b023a28e and fixed in 7.1.4 with commit 3317a5d015fca976475aa71df224056777316fde
	Issue introduced in 6.8 with commit 4f1fffa2376922f3d1d506e49c0fd445b023a28e and fixed in 7.2-rc1 with commit 9647492b5e41954be59d5157eddbcd4cdc1656f7

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2026-64387
will be updated if fixes are backported, please check that for the most
up to date information about this issue.


Affected files
==============

The file(s) affected by this issue are:
	fs/smb/client/smb2pdu.c


Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/3409aedf3c81a810243da94164f6621c9d205c98
	https://git.kernel.org/stable/c/1665f25b1dea30bf2d02e16245d203a944c9d994
	https://git.kernel.org/stable/c/00b0fa425941438b664950a8ee65dfba2def4336
	https://git.kernel.org/stable/c/3317a5d015fca976475aa71df224056777316fde
	https://git.kernel.org/stable/c/9647492b5e41954be59d5157eddbcd4cdc1656f7