Commit b5e4f73
bridge: Fix a deadlock when enabling multicast snooping
BugLink: https://bugs.launchpad.net/bugs/1910817
[ Upstream commit 851d0a7 ]
When enabling multicast snooping, bridge module deadlocks on multicast_lock
if 1) IPv6 is enabled, and 2) there is an existing querier on the same L2
network.
The deadlock was caused by the following sequence: While holding the lock,
br_multicast_open calls br_multicast_join_snoopers, which eventually causes
IP stack to (attempt to) send out a Listener Report (in igmp6_join_group).
Since the destination Ethernet address is a multicast address, br_dev_xmit
feeds the packet back to the bridge via br_multicast_rcv, which in turn
calls br_multicast_add_group, which then deadlocks on multicast_lock.
The fix is to move the call br_multicast_join_snoopers outside of the
critical section. This works since br_multicast_join_snoopers only deals
with IP and does not modify any multicast data structures of the bridge,
so there's no need to hold the lock.
Steps to reproduce:
1. sysctl net.ipv6.conf.all.force_mld_version=1
2. have another querier
3. ip link set dev bridge type bridge mcast_snooping 0 && \
ip link set dev bridge type bridge mcast_snooping 1 < deadlock >
A typical call trace looks like the following:
[ 936.251495] _raw_spin_lock+0x5c/0x68
[ 936.255221] br_multicast_add_group+0x40/0x170 [bridge]
[ 936.260491] br_multicast_rcv+0x7ac/0xe30 [bridge]
[ 936.265322] br_dev_xmit+0x140/0x368 [bridge]
[ 936.269689] dev_hard_start_xmit+0x94/0x158
[ 936.273876] __dev_queue_xmit+0x5ac/0x7f8
[ 936.277890] dev_queue_xmit+0x10/0x18
[ 936.281563] neigh_resolve_output+0xec/0x198
[ 936.285845] ip6_finish_output2+0x240/0x710
[ 936.290039] __ip6_finish_output+0x130/0x170
[ 936.294318] ip6_output+0x6c/0x1c8
[ 936.297731] NF_HOOK.constprop.0+0xd8/0xe8
[ 936.301834] igmp6_send+0x358/0x558
[ 936.305326] igmp6_join_group.part.0+0x30/0xf0
[ 936.309774] igmp6_group_added+0xfc/0x110
[ 936.313787] __ipv6_dev_mc_inc+0x1a4/0x290
[ 936.317885] ipv6_dev_mc_inc+0x10/0x18
[ 936.321677] br_multicast_open+0xbc/0x110 [bridge]
[ 936.326506] br_multicast_toggle+0xec/0x140 [bridge]
Fixes: 4effd28 ("bridge: join all-snoopers multicast address")
Signed-off-by: Joseph Huang <[email protected]>
Acked-by: Nikolay Aleksandrov <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Kamal Mostafa <[email protected]>
Signed-off-by: Kelsey Skunberg <[email protected]>1 parent 664124b commit b5e4f73
3 files changed
+41
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
171 | 174 | | |
172 | 175 | | |
173 | 176 | | |
| |||
188 | 191 | | |
189 | 192 | | |
190 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
191 | 197 | | |
192 | 198 | | |
193 | 199 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1848 | 1848 | | |
1849 | 1849 | | |
1850 | 1850 | | |
1851 | | - | |
| 1851 | + | |
1852 | 1852 | | |
1853 | 1853 | | |
1854 | 1854 | | |
| |||
1879 | 1879 | | |
1880 | 1880 | | |
1881 | 1881 | | |
1882 | | - | |
| 1882 | + | |
1883 | 1883 | | |
1884 | 1884 | | |
1885 | 1885 | | |
| |||
1898 | 1898 | | |
1899 | 1899 | | |
1900 | 1900 | | |
1901 | | - | |
1902 | | - | |
1903 | | - | |
1904 | 1901 | | |
1905 | 1902 | | |
1906 | 1903 | | |
| |||
1916 | 1913 | | |
1917 | 1914 | | |
1918 | 1915 | | |
1919 | | - | |
1920 | | - | |
1921 | | - | |
1922 | 1916 | | |
1923 | 1917 | | |
1924 | 1918 | | |
| |||
2049 | 2043 | | |
2050 | 2044 | | |
2051 | 2045 | | |
| 2046 | + | |
2052 | 2047 | | |
2053 | 2048 | | |
2054 | 2049 | | |
| |||
2057 | 2052 | | |
2058 | 2053 | | |
2059 | 2054 | | |
2060 | | - | |
| 2055 | + | |
2061 | 2056 | | |
2062 | 2057 | | |
2063 | 2058 | | |
| |||
2068 | 2063 | | |
2069 | 2064 | | |
2070 | 2065 | | |
| 2066 | + | |
| 2067 | + | |
2071 | 2068 | | |
2072 | 2069 | | |
2073 | 2070 | | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
| 2082 | + | |
| 2083 | + | |
| 2084 | + | |
| 2085 | + | |
| 2086 | + | |
| 2087 | + | |
| 2088 | + | |
| 2089 | + | |
2074 | 2090 | | |
2075 | 2091 | | |
2076 | 2092 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
665 | 665 | | |
666 | 666 | | |
667 | 667 | | |
| 668 | + | |
| 669 | + | |
668 | 670 | | |
669 | 671 | | |
670 | 672 | | |
| |||
792 | 794 | | |
793 | 795 | | |
794 | 796 | | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
795 | 805 | | |
796 | 806 | | |
797 | 807 | | |
| |||
0 commit comments