WSL2-Linux-Kernel/net/bridge
Vladimir Oltean 99f62a7460 net: bridge: br_vlan_get_pvid_rcu() should dereference the VLAN group under RCU
When calling the RCU brother of br_vlan_get_pvid(), lockdep warns:

=============================
WARNING: suspicious RCU usage
5.9.0-rc3-01631-g13c17acb8e38-dirty #814 Not tainted
-----------------------------
net/bridge/br_private.h:1054 suspicious rcu_dereference_protected() usage!

Call trace:
 lockdep_rcu_suspicious+0xd4/0xf8
 __br_vlan_get_pvid+0xc0/0x100
 br_vlan_get_pvid_rcu+0x78/0x108

The warning is because br_vlan_get_pvid_rcu() calls nbp_vlan_group()
which calls rtnl_dereference() instead of rcu_dereference(). In turn,
rtnl_dereference() calls rcu_dereference_protected() which assumes
operation under an RCU write-side critical section, which obviously is
not the case here. So, when the incorrect primitive is used to access
the RCU-protected VLAN group pointer, READ_ONCE() is not used, which may
cause various unexpected problems.

I'm sad to say that br_vlan_get_pvid() and br_vlan_get_pvid_rcu() cannot
share the same implementation. So fix the bug by splitting the 2
functions, and making br_vlan_get_pvid_rcu() retrieve the VLAN groups
under proper locking annotations.

Fixes: 7582f5b70f ("bridge: add br_vlan_get_pvid_rcu()")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-21 17:37:44 -07:00
..
netfilter netfilter: ebtables: reject bogus getopt len value 2020-08-14 11:59:08 +02:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile
br.c
br_arp_nd_proxy.c bridge: Avoid infinite loop when suppressing NS messages with invalid options 2020-06-01 11:08:41 -07:00
br_device.c net: bridge: clear bridge's private skb space on xmit 2020-08-03 15:26:46 -07:00
br_fdb.c net: bridge: add a flag to avoid refreshing fdb when changing/adding 2020-06-24 14:36:33 -07:00
br_forward.c
br_if.c net: bridge: allow enslaving some DSA master network devices 2020-05-10 19:52:33 -07:00
br_input.c net: bridge: allow enslaving some DSA master network devices 2020-05-10 19:52:33 -07:00
br_ioctl.c
br_mdb.c
br_mrp.c bridge: mrp: Implement the MRP Interconnect API 2020-07-14 13:46:43 -07:00
br_mrp_netlink.c bridge: mrp: Extend br_mrp_fill_info 2020-07-14 13:46:43 -07:00
br_mrp_switchdev.c bridge: switchdev: mrp: Extend MRP API for switchdev for MRP Interconnect 2020-07-14 13:46:43 -07:00
br_multicast.c bridge: mcast: Fix MLD2 Report IPv6 payload length check 2020-07-07 15:37:57 -07:00
br_netfilter_hooks.c
br_netfilter_ipv6.c
br_netlink.c net: bridge: Add port attribute IFLA_BRPORT_MRP_IN_OPEN 2020-07-14 13:46:43 -07:00
br_netlink_tunnel.c net: bridge: notify on vlan tunnel changes done via the old api 2020-07-12 15:18:24 -07:00
br_nf_core.c
br_private.h net: bridge: fix undefined br_vlan_can_enter_range in tunnel code 2020-07-13 11:22:55 -07:00
br_private_mrp.h bridge: mrp: Implement the MRP Interconnect API 2020-07-14 13:46:43 -07:00
br_private_stp.h
br_private_tunnel.h
br_stp.c
br_stp_bpdu.c
br_stp_if.c net: remove newlines in NL_SET_ERR_MSG_MOD 2020-05-07 17:56:14 -07:00
br_stp_timer.c
br_switchdev.c
br_sysfs_br.c
br_sysfs_if.c
br_vlan.c net: bridge: br_vlan_get_pvid_rcu() should dereference the VLAN group under RCU 2020-09-21 17:37:44 -07:00
br_vlan_options.c
br_vlan_tunnel.c