CRITICAL Introduced in 6.4
sunrpc HandshakeCallback UAF
CVE-2026-72222
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
KernelScan AI8.1HIGH
01Description
In the Linux kernel, the following vulnerability has been resolved: sunrpc: pin svc_xprt across the asynchronous TLS handshake callback svc_tcp_handshake() stores the raw svc_xprt pointer in tls_handshake_args.ta_data and submits the request through tls_server_hello_x509(). The handshake core takes only sock_hold(req->hr_sk); nothing references the embedding struct svc_sock that svc_tcp_handshake_done() reaches via container_of(). Two close races leave the in-flight callback writing through a freed svc_sock. svc_sock_free() calls tls_handshake_cancel() and discards its return value: a false return means handshake_complete() has already set HANDSHAKE_F_REQ_COMPLETED but hp_done() may not have finished, yet svc_sock_free() proceeds to kfree(svsk). The cancel-loser fall-through inside svc_tcp_handshake() itself produces the same window: when wait_for_completion_interruptible_timeout() returns <= 0 (timeout or signal) and tls_handshake_cancel() returns false, the function does not drain, returns, and svc_handle_xprt() calls svc_xprt_received(), which clears XPT_BUSY and can drop the last reference. A concurrent close then runs svc_sock_free() while svc_tcp_handshake_done() is still updating xpt_flags and walking svsk->sk_handshake_done. The corruption surfaces as set_bit/clear_bit RMW into the freed xpt_flags slab slot and as complete_all() walking and writing the freed wait_queue_head_t list embedded in sk_handshake_done -- a slab-corruption primitive, not a benign read. The path is reachable on any TLS-enabled NFS server whenever a connection close overlaps the tlshd downcall delivery window; the interruptible wait means signal delivery suffices, not just SVC_HANDSHAKE_TO expiry. Take svc_xprt_get(xprt) immediately before tls_server_hello_x509() so the in-flight callback owns its own reference. Release it on the two edges where the callback is guaranteed not to fire -- submission failure from tls_server_hello_x509() and a successful tls_handshake_cancel() -- and at the tail of svc_tcp_handshake_done() after complete_all(). [cel: rewrote commit message to describe the actual change]
02KernelScan AI Analysis
Risk summary
A remote attacker can trigger a use-after-free in any TLS-enabled Linux NFS server by connecting and closing the connection during the asynchronous TLS handshake window. The freed slab is written to by the in-flight handshake callback, producing a slab-corruption primitive that can lead to kernel code execution or a panic. No authentication or special privileges are required — only network reachability to the NFS service.
Vulnerability analysis
When a client connects to a TLS-enabled NFS server, the server submits an asynchronous TLS handshake request and stores a raw pointer to its transport structure for the eventual callback. Nothing keeps that transport alive while the handshake is in flight, so two race windows allow a concurrent connection close to free the transport before the callback finishes writing to it — one during normal teardown and another when the handshake wait is interrupted by a signal or timeout. The callback then performs read-modify-write operations on flags and walks a wait-queue structure embedded in the freed object, corrupting the slab. The fix takes an extra reference on the transport before submitting the handshake so the callback always owns a valid object, and releases that reference only on paths where the callback is guaranteed not to fire or after the callback has completed. Any network client reaching a TLS-enabled NFS server can trigger this by timing a connection close against the handshake downcall delivery; no privileges or authentication are needed.
Lifecycle
03Fix Versions
| Branch | Introduced | Fixed in | Patch commit |
|---|---|---|---|
| 6.12 | 6.4 | 6.12.97 | 2d4f97d13fff |
| 7.1 | 6.4 | 7.1.5 | 083e9c2ec7e8 |
| mainline | 6.4 | 7.2-rc1 | 4f988f3a2808 |
| 6.6 | 6.4 | 6.6.145 | f3b55945dd99 |
| 6.18 | 6.4 | 6.18.40 | 3f9ee75a97a7 |