CVE-2026-64523: net/handshake: Take a long-lived file reference at submit

Greg Kroah-Hartman <[email protected]> Sat, 25 Jul 2026 11:19:33 +0200
Newsgroups org.kernel.vger.linux-cve-announce
Message-ID <2026072533-CVE-2026-64523-ebb0@gregkh>
From: Greg Kroah-Hartman <[email protected]>

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

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

net/handshake: Take a long-lived file reference at submit

handshake_nl_accept_doit() needs the file pointer backing
req->hr_sk->sk_socket to survive the window between
handshake_req_next() and the subsequent FD_PREPARE() and get_file().
The submit-side sock_hold() does not provide that.  sk_refcnt keeps
struct sock alive, but struct socket is owned by sock->file: when
the consumer fputs the last file reference, sock_release() tears
the socket down regardless of any sock_hold.

Add an hr_file pointer to struct handshake_req and acquire an
explicit reference on sock->file during handshake_req_submit().
handshake_complete() and handshake_req_cancel() release the
reference on the completion-bit-winning path.

The submit error path must also release the file reference, but
after rhashtable insertion a concurrent handshake_req_cancel() can
discover the request and race the error path.  Gate the error-path
cleanup -- sk_destruct restoration, fput, and request destruction
-- with test_and_set_bit(HANDSHAKE_F_REQ_COMPLETED), the same
serialization handshake_complete() and handshake_req_cancel()
already use.  When cancel has already claimed ownership, the submit
error path returns without touching the request; socket teardown
handles final destruction.

The accept-side dereferences are not yet retargeted; that change
comes in the next patch.

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


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

	Fixed in 6.12.93 with commit 685b10dd0e32c7782cead16c8cf055c609678583
	Fixed in 7.0.12 with commit 16eaba5aa89c04eea125905bb8f988c1897f4f29
	Fixed in 7.1 with commit 09dba37eee70d0596e26645015f1aa95a9848e9d

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-64523
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:
	net/handshake/handshake.h
	net/handshake/netlink.c
	net/handshake/request.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/685b10dd0e32c7782cead16c8cf055c609678583
	https://git.kernel.org/stable/c/16eaba5aa89c04eea125905bb8f988c1897f4f29
	https://git.kernel.org/stable/c/09dba37eee70d0596e26645015f1aa95a9848e9d