summaryrefslogtreecommitdiff
path: root/tools/lib/python/kdoc/python_version.py
diff options
context:
space:
mode:
authorChengfeng Ye <nicoyip.dev@gmail.com>2026-10-01 02:11:06 +0800
committerJakub Kicinski <kuba@kernel.org>2026-10-05 15:53:05 -0700
commita9d60b086944155e0e1c2265d739d3455154ab10 (patch)
tree9b8b9747a737787aa791e2de028dc3fc432eade4 /tools/lib/python/kdoc/python_version.py
parentecf5985006dd0505b2f700ef22fb9beac0ad3457 (diff)
net-sysfs: release queue trackers before allowing reuse
An interrupted sysfs_rtnl_lock() can drop the last kobject reference to a removed TX queue without holding RTNL. netdev_queue_release() clears the kobject before releasing queue->dev_tracker, allowing the queue to be re-added while the old release still needs the shared tracker slot: CPU 0 CPU 1 netdev_queue_release() memset(kobj, 0, sizeof(*kobj)) netdev_queue_add_kobject() state_initialized is clear netdev_hold() installs new tracker netdev_put() releases the new tracker With CONFIG_NET_DEV_REFCNT_TRACKER enabled, the old tracker is leaked and the new lifetime's tracker is released prematurely. A later queue release then reports a double release. The numeric device references remain balanced. The kernel reported: ref_tracker: reference already released. ref_tracker: allocated in: netdev_queue_update_kobjects+0x23d/0x5c0 netif_set_real_num_tx_queues+0x111/0x820 veth_set_channels+0x327/0x930 ethtool_set_channels+0x3ee/0x490 ref_tracker: freed in: netdev_queue_release+0xbd/0x130 kobject_put+0x1f9/0x280 sysfs_rtnl_lock+0x18b/0x1f0 xps_rxqs_show+0xad/0x250 WARNING: lib/ref_tracker.c:322 at ref_tracker_free+0x49e/0x6d0 Call Trace: netdev_queue_release+0xbd/0x130 kobject_put+0x1f9/0x280 netdev_queue_update_kobjects+0x3f9/0x5c0 netif_set_real_num_tx_queues+0x111/0x820 veth_set_channels+0x327/0x930 ethtool_set_channels+0x3ee/0x490 RX queues have the same ordering. Their removal and re-addition are normally serialized by RTNL, but CONFIG_DEBUG_KOBJECT_RELEASE can defer the release callback to workqueue context and expose the same reuse window. Release each tracker before clearing its kobject. Pair full memory barriers on the release and add sides so that an add which observes state_initialized clear cannot install a new tracker before the old release has finished accessing the shared tracker slot. Keep the numeric device reference until after the reset so that the queue storage remains alive throughout the callback's accesses. Cc: stable+noautosel@kernel.org # bug in debug instrumentation Fixes: b0b6fcfa6ad8 ("net-sysfs: remove rtnl_trylock from queue attributes") Signed-off-by: Chengfeng Ye <nicoyip.dev@gmail.com> Reviewed-by: Eric Dumazet <edumazet@kernel.org> Reviewed-by: Antoine Tenart <atenart@kernel.org> Link: https://patch.msgid.link/20260930181106.271547-1-nicoyip.dev@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/lib/python/kdoc/python_version.py')
0 files changed, 0 insertions, 0 deletions