{"id":"CVE-2026-143160","summary":"net/smc: fix lgr/lnk lifetime vs diag reader race","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nnet/smc: fix lgr/lnk lifetime vs diag reader race\n\nThe diag dump walks the socket hash table under a read_lock and\ndereferences conn-\u003elgr and conn-\u003elnk. Several paths expose a window\nwhere a hashed socket has freed or partially freed conn/lgr/lnk state.\n\nFirst, smc_conn_abort() calls smc_conn_free() during early handshake\naborts while the socket is still hashed in SMC_INIT, synchronously\nfreeing the lgr on the smc_lgr_cleanup_early() path without holding the\nhash write_lock. A concurrent diag reader can load a non-NULL conn-\u003elgr\nand dereference it after the kfree. Skip the connection, link group and\nDMB attributes in __smc_diag_dump() for sockets in SMC_INIT or\nSMC_CLOSED or fallen back to TCP, and take diag_mode from an is_smcd\nflag cached at connection creation.\n\nThe state filter alone does not close the race. A connection aborted by\na failed handshake can keep its alert token, because smc_conn_free()\nskips the unregister when smc_lgr_terminate_sched() has emptied\nlgr-\u003elist; close_work may also have been queued before the abort, as the\nCDC receive path is not excluded by the handshake's socket lock.\nsmc_close_passive_work() would then move the hashed socket from SMC_INIT\nto SMC_APPCLOSEWAIT1 or SMC_PROCESSABORT, states the filter does not\ncover, and later run a passive-closing sock_put() that\nsmc_connect_decline_fallback() dropped already. Return early from\nsmc_close_passive_work() when the connection was freed; the check holds\nthe socket lock that every smc_conn_free() caller holds as well, so a\nhashed socket with a freed connection stays in SMC_INIT or SMC_CLOSED\nuntil release.\n\nThis changes the sock_diag output for such sockets: the connection, link\ngroup and DMB attributes are omitted, which smcss does not read for\nsockets in these states, while SMC_DIAG_FALLBACK is still reported and\nan SMC-D socket in SMC_INIT or SMC_CLOSED still reports\nSMC_DIAG_MODE_SMCD from the cached flag. A fallback socket is a plain\nTCP socket with no SMC connection state to report; the stale conn fields\nleft behind by smc_conn_abort() must not be read.\n\nSecond, in smc_conn_kill() on SMC-D with dmb_nocopy, smcd_buf_detach()\nNULLs and frees conn-\u003esndbuf_desc while the socket is still hashed. A\nconcurrent diag reader entering the CONNINFO block can dereference the\nfreed descriptor. Unhash the socket right before smcd_buf_detach(). As a\nresult, killed ACTIVE and APPCLOSEWAIT sockets that are still open are\nno longer visible to smcss on loopback-ism devices.\n\nThird, in the terminal teardown branches of smc_close_active_abort()\n(PEERCLOSEWAIT and PROCESSABORT groups) and in smc_close_passive_work(),\nsmc_conn_free() drops lgr and lnk references while the socket is still\nhashed. Unhash immediately before each smc_conn_free() call at those\nsites. Sockets killed in those close states are therefore unhashed, and\ntheir inuse accounting dropped, before close(), even if the fd is still\nopen.\n\nFourth, use smp_load_acquire() / smp_store_release() on sk_state to\norder these checks on weakly ordered CPUs. A reader that observes\nSMC_ACTIVE is guaranteed to see the connection setup that preceded the\nstore; a reader that observes SMC_CLOSED from smc_listen_out_err() skips\nthe connection fields in any case, so that particular store is hardening\nkept for uniformity, not a required ordering.\n\nAdditionally, in __smc_diag_dump(), use the cached link-\u003eibname instead\nof link-\u003esmcibdev-\u003eibdev-\u003ename, avoiding a NULL pointer dereference or\nuse-after-free of the IB device when __smcr_link_clear() zeroes the link\nduring concurrent SMC-R link failover. The link data is still read\nwithout conns_lock or send_lock, so a dump racing a failover may\ntransiently report zeroed or mixed link fields; this does not affect\nmemory safety and the next dump reports the new link. Like the SMC\nnetlink link dump and the tracepoints, the name is the one cached at\nlink creation time.","modified":"2026-12-03T11:01:29.105596004Z","published":"2026-12-03T09:19:59.813Z","database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/143xxx/CVE-2026-143160.json"},"references":[{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"},{"type":"WEB","url":"https://git.kernel.org/stable/c/16d19661c3dc49c70d9941e29ee267328d2dbd27"},{"type":"WEB","url":"https://git.kernel.org/stable/c/3871bd1cc528b3f9c13eec6d7f8de4a33461c1af"},{"type":"WEB","url":"https://git.kernel.org/stable/c/d7900fa51642fbc2a5a03354238e71050a7d391d"},{"type":"WEB","url":"https://git.kernel.org/stable/c/f57659ad6fe30d130cb27a09e61f3ac9c80c99a4"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/143xxx/CVE-2026-143160.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-143160"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"f16a7dd5cf27eeda187425c9c7d96802a549f9c4"},{"fixed":"16d19661c3dc49c70d9941e29ee267328d2dbd27"},{"fixed":"f57659ad6fe30d130cb27a09e61f3ac9c80c99a4"},{"fixed":"3871bd1cc528b3f9c13eec6d7f8de4a33461c1af"},{"fixed":"d7900fa51642fbc2a5a03354238e71050a7d391d"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-143160.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"4.11.0"},{"fixed":"6.12.120"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.13.0"},{"fixed":"6.18.66"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"7.3.7"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-143160.json"}}],"schema_version":"1.9.2"}