AZL-118229: CVE-2026-143160 affecting package kernel 6.6.161.1-1
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.
- Compensating control
Unhash the socket before calling smc_conn_free() in the early-handshake abort path and in the terminal teardown branches of smc_close_active_abort().
- Compensating control
In smc_conn_kill() for SMC-D with dmb_nocopy, unhash the socket immediately before calling smcd_buf_detach().
- Compensating control
In __smc_diag_dump(), use the cached link->ibname instead of dereferencing link->smcibdev->ibdev->name.
- Compensating control
In __smc_diag_dump(), derive SMC_DIAG_MODE_SMCD from the cached is_smcd flag set at connection creation.
- Compensating control
Use smp_load_acquire() and smp_store_release() when reading and writing sk_state to order the state checks on weakly ordered CPUs.
- Compensating control
Return early from smc_close_passive_work() when the connection has already been freed.
- Compensating control
Omit connection, link-group, and DMB attributes from diagnostic output for sockets in SMC_INIT or SMC_CLOSED.
Event History
Frequently Asked Questions
Which systems are exposed to this race condition?
Systems using the affected Azure Linux kernel package are exposed when the SMC networking subsystem is in use and diagnostic dumping can run concurrently with SMC connection setup, abort, or teardown activity.
What conditions are required for exploitation or triggering?
The issue requires a concurrent SMC diagnostic reader and a socket whose SMC connection, link group, or link state is being freed or is partially freed. Failed handshakes and connection cleanup paths can leave a socket hashed while related state is released.
Are TCP-fallback connections relevant?
The fix specifically excludes sockets that have fallen back to TCP from connection, link-group, and DMB diagnostic attributes. Such sockets were among the states requiring diagnostic handling changes.
How can I determine whether the vulnerable condition may have occurred?
Review kernel diagnostic or crash evidence for use-after-free or null-pointer dereference events involving SMC diagnostic dumping, SMC connection cleanup, link groups, or links. The provided data does not identify a user-space indicator or configuration check for prior exposure.