{"id":"CVE-2026-143128","summary":"net: wait for in-flight device unregistrations before netns dismantle","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nnet: wait for in-flight device unregistrations before netns dismantle\n\nA device can be unregistered by a context other than the cleanup_net()\nof its own netns, for instance a veth whose peer in another netns is\ndeleted. If references on it are still held, it stays in\nnetdev_wait_allrefs_any(), which rebroadcasts NETDEV_UNREGISTER every\nsecond.\n\nMeanwhile its netns can be dismantled: default_device_exit_batch()\nonly takes care of devices still listed in the netns, then pernet exit\nhandlers free their state, and finally struct net is freed while the\ndevice still points to it.\n\nThe rebroadcasts then run notifiers against torn down pernet state, or\nfreed memory. Three instances were reported so far:\n\n - netdev_genl_netdevice_event(): net-\u003egenl_sock is NULL [1]\n - nh_netdev_event(): net-\u003enexthop.devhash is NULL [2]\n - nf_tables netdevice notifiers: use-after-free of the nftables\n   pernet storage [3]\n\nbut any notifier using dev_net(dev) is affected, as is\nnetdev_wait_allrefs_any() itself (__rtnl_net_lock(dev_net(dev)) with\nCONFIG_DEBUG_NET_SMALL_RTNL=y).\n\nThis was prevented by rtnl_lock_unregistering() until I removed it\nin commit 8a4fc54b07d7 (\"net: get rid of rtnl_lock_unregistering()\"),\nconsidering only the loopback dependency, and missing the notifiers one.\n\nRestore a per-netns counter of devices sitting in netdev_run_todo(),\nand make default_device_exit_batch() wait for it to reach zero, after\nit has unregistered all devices of the dying netns(es). At this point\nno new unregistration can be started for these netns.\n\nUnlike the old barrier, this only waits for devices of the netns being\ndismantled and runs after their own devices are gone.\n\nTested on a KASAN kernel with a debug-only hack holding a reference\non a veth device for 5 seconds after its unregistration: a nexthop\non the veth in netns X, delete its peer from init_net, then delete X.\nWithout this patch, the nexthop_flush_dev() null-ptr-deref from [2]\ntriggers. With it, no splat; netns churn and dismantle of a netns\nwhose own device is held still work.\n\n[1] https://lore.kernel.org/netdev/6adf9f64.6200f071.51519.0ed1.GAE@google.com/\n[2] https://lore.kernel.org/netdev/20261105114707.3030737-1-bsdhenrymartin@gmail.com/\n[3] https://lore.kernel.org/netdev/20261105114817.3033625-1-bsdhenrymartin@gmail.com/","modified":"2026-12-03T11:01:16.850578008Z","published":"2026-12-03T09:19:37.294Z","database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/143xxx/CVE-2026-143128.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/a9535834de431aa37bb7fdc436ec570562226da5"},{"type":"WEB","url":"https://git.kernel.org/stable/c/c164a431a646983275d0076ff5b0e4c326fbc10b"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/143xxx/CVE-2026-143128.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-143128"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"8a4fc54b07d756f1884af6c47ec84dfa3da663df"},{"fixed":"a9535834de431aa37bb7fdc436ec570562226da5"},{"fixed":"c164a431a646983275d0076ff5b0e4c326fbc10b"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-143128.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"5.18.0"},{"fixed":"7.3.7"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-143128.json"}}],"schema_version":"1.9.2"}