CVE-2026-143160: net/smc: fix lgr/lnk lifetime vs diag reader race
In the Linux kernel, the following vulnerability has been resolved:
net/smc: fix lgr/lnk lifetime vs diag reader race
The diag dump walks the socket hash table under a readlock and dereferences conn->lgr and conn->lnk. Several paths expose a window where a hashed socket has freed or partially freed conn/lgr/lnk state.
First, smcconnabort() calls smcconnfree() during early handshake aborts while the socket is still hashed in SMCINIT, synchronously freeing the lgr on the smclgrcleanupearly() path without holding the hash writelock. A concurrent diag reader can load a non-NULL conn->lgr and dereference it after the kfree. Skip the connection, link group and DMB attributes in smcdiagdump() for sockets in SMCINIT or SMCCLOSED or fallen back to TCP, and take diagmode from an issmcd flag cached at connection creation.
The state filter alone does not close the race. A connection aborted by a failed handshake can keep its alert token, because smcconnfree() skips the unregister when smclgrterminatesched() has emptied lgr->list; closework may also have been queued before the abort, as the CDC receive path is not excluded by the handshake's socket lock. smcclosepassivework() would then move the hashed socket from SMCINIT to SMCAPPCLOSEWAIT1 or SMCPROCESSABORT, states the filter does not cover, and later run a passive-closing sockput() that smcconnectdeclinefallback() dropped already. Return early from smcclosepassivework() when the connection was freed; the check holds the socket lock that every smcconnfree() caller holds as well, so a hashed socket with a freed connection stays in SMCINIT or SMCCLOSED until release.
This changes the sockdiag output for such sockets: the connection, link group and DMB attributes are omitted, which smcss does not read for sockets in these states, while SMCDIAGFALLBACK is still reported and an SMC-D socket in SMCINIT or SMCCLOSED still reports SMCDIAGMODESMCD from the cached flag. A fallback socket is a plain TCP socket with no SMC connection state to report; the stale conn fields left behind by smcconnabort() must not be read.
Second, in smcconnkill() on SMC-D with dmbnocopy, smcdbufdetach() NULLs and frees conn->sndbufdesc while the socket is still hashed. A concurrent diag reader entering the CONNINFO block can dereference the freed descriptor. Unhash the socket right before smcdbufdetach(). As a result, killed ACTIVE and APPCLOSEWAIT sockets that are still open are no longer visible to smcss on loopback-ism devices.
Third, in the terminal teardown branches of smccloseactiveabort() (PEERCLOSEWAIT and PROCESSABORT groups) and in smcclosepassivework(), smcconnfree() drops lgr and lnk references while the socket is still hashed. Unhash immediately before each smcconnfree() call at those sites. Sockets killed in those close states are therefore unhashed, and their inuse accounting dropped, before close(), even if the fd is still open.
Fourth, use smploadacquire() / smpstorerelease() on skstate to order these checks on weakly ordered CPUs. A reader that observes SMCACTIVE is guaranteed to see the connection setup that preceded the store; a reader that observes SMCCLOSED from smclistenouterr() skips the connection fields in any case, so that particular store is hardening kept for uniformity, not a required ordering.
Additionally, in smcdiagdump(), use the cached link->ibname instead of link->smcibdev->ibdev->name, avoiding a NULL pointer dereference or use-after-free of the IB device when smcrlinkclear() zeroes the link during concurrent SMC-R link failover. The link data is still read without connslock or sendlock, so a dump racing a failover may transiently report zeroed or mixed link fields; this does not affect memory safety and the next dump reports the new link. Like the SMC netlink link dump and the tracepoints, the name is the one cached at link creation time.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.12.120 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.66 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.7
Event History
Frequently Asked Questions
Which systems are exposed to this race?
The issue applies to Linux kernel systems using SMC sockets where diagnostic dump readers can run concurrently with SMC connection teardown or handshake failure handling. The affected objects are SMC connections that remain in the socket hash table while associated link-group or link state is freed or only partially cleaned up.
What timing is required to trigger the issue?
A diagnostic reader must inspect a hashed SMC socket while another path aborts or closes the connection and frees its connection, link-group, or link state. The described windows include an early failed handshake in SMC_INIT, cleanup of a connection that retains an alert token, and close work that may already have been queued.
Are sockets that fall back to TCP relevant?
Yes. The fix excludes connection, link-group, and DMB diagnostic attributes not only for SMC_INIT and SMC_CLOSED sockets, but also for sockets that have fallen back to TCP. This indicates diagnostic handling of fallback state is part of the unsafe lifetime scenarios addressed by the fix.