summaryrefslogtreecommitdiff
path: root/scripts/Makefile.thinlto
diff options
context:
space:
mode:
authorJinjie Ruan <ruanjinjie@huawei.com>2026-09-02 15:33:33 +0800
committerJakub Kicinski <kuba@kernel.org>2026-09-05 12:43:12 -0700
commit2e9ff7bb668b6f62f4789718f70fd1ec2eb87c12 (patch)
treecc56c43e84dd117321e1abd0c99f17fa8d15fd2f /scripts/Makefile.thinlto
parentd76beefca7e52ef2fd7a4a504e862d85be60072a (diff)
downloadlinux-next-2e9ff7bb668b6f62f4789718f70fd1ec2eb87c12.tar.gz
linux-next-2e9ff7bb668b6f62f4789718f70fd1ec2eb87c12.zip
8021q: Fix data race when publishing vlan net_device pointers
A plain C read and assignment of the net_device pointer in the vlan_devices_arrays leaf entries lack proper atomicity and ordering barriers. A concurrent lockless reader on the packet receive fast-path could observe a torn or partially initialized net_device pointer, leading to a potential out-of-bounds read or kernel panic. The data race occurs between the netlink/ioctl configuration paths (holding the per-netns rtnl_nets_lock or RTNL lock) and the softirq receive fast-path (holding rcu_read_lock()): CPU 0 (Writer, rtnl_nets_lock/RTNL) CPU 1 (Reader, rcu_read_lock()) ----------------------------------- ------------------------------- rtnetlink_rcv_msg() // RTM_NEWLINK handler with RTNL_FLAG_DOIT_PERNET rtnl_newlink() ops->newlink() == vlan_newlink() OR vlan_ioctl_handler() [ADD_VLAN_CMD] -> register_vlan_device() register_vlan_dev() vlan_group_set_device() netif_receive_skb_core() vlan_do_receive() vlan_find_dev() __vlan_group_get_device() // Speculative / torn read [Loads bad net_device *] [Plain C store] array[vlan_id] = dev; // Dereferences bad pointer // during device status check vlan_dev->flags (PANIC!) Fix this by using rcu_assign_pointer() in vlan_group_set_device() and rcu_dereference_raw() in __vlan_group_get_device() to enforce proper ordering and memory atomicity for the leaf entry traversal. Link: https://sashiko.dev/#/patchset/20260825095422.3166067-1-ruanjinjie%40huawei.com Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions