gluon/patches/openwrt
Linus Lüssing 13cb7504f4 kernel: bridge: Fix a deadlock when enabling multicast snooping
[ Upstream commit 851d0a73c90e6c8c63fef106c6c1e73df7e05d9d ]

From: Joseph Huang <Joseph.Huang@garmin.com>

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: 4effd28c1245 ("bridge: join all-snoopers multicast address")
Signed-off-by: Joseph Huang <Joseph.Huang@garmin.com>
Acked-by: Nikolay Aleksandrov <nikolay@nvidia.com>
Link: https://lore.kernel.org/r/20201204235628.50653-1-Joseph.Huang@garmin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[linus.luessing@c0d3.blue: backported to 4.4]
2021-01-25 03:16:06 +01:00
..
0001-procd-add-support-for-alternative-rc.d-directories.patch Refresh OpenWrt package patches 2019-11-23 17:28:17 +01:00
0002-base-files-disable-reset-button-handling.patch Switch to OpenWrt 18.06 branch 2018-07-10 22:57:40 +02:00
0003-libjson-c-Add-support-for-custom-format-strings-for-doubles.patch Refresh OpenWrt package patches 2019-11-23 17:28:17 +01:00
0004-dropbear-add-a-failsafe-mode-that-will-always-allow-password-less-root-login.patch hostapd: drop obsolete channel selection patch 2019-11-06 22:02:04 +01:00
0005-kernel-ebtables-add-support-for-ICMP-IGMP-type-matches.patch kernel: refresh patches 2019-11-19 23:43:37 +01:00
0006-build-set-TARGET_ROOTFS_PARTSIZE-to-make-combined-image-fit-in-128MB.patch patches/openwrt: add set TARGET_ROOTFS_PARTSIZE to make combined image fit in 128MB 2019-12-28 18:06:43 +01:00
0007-ipq-wifi-add-BDF-for-Aruba-AP-303.patch ipq40xx-generic: add support for Aruba AP-303 2020-01-04 01:43:10 +01:00
0008-ipq40xx-add-support-for-Aruba-AP-303.patch ipq40xx-generic: add support for Aruba AP-303 2020-01-04 01:43:10 +01:00
0009-ath79-enable-GL-AR750S-NOR-variant-from-master.patch openwrt: refresh patches 2020-08-02 00:32:10 +02:00
0010-tools-add-zstd.patch modules: refresh OpenWrt patches 2020-12-07 04:27:11 +01:00
0011-build-compress-kernel-debuginfo-using-zstd.patch build: backport kernel debuginfo ZSTD compression 2020-05-31 11:12:41 +02:00
0012-mac80211-rt2800-enable-MFP-support-unconditionally.patch mac80211: rt2800: enable MFP support unconditionally 2020-06-10 22:41:01 +02:00
0013-mt76-mt76x0-disable-GTK-offloading.patch mt76: mt76x0: disable GTK offloading 2020-06-13 23:07:05 +02:00
0014-mac80211-create-channel-list-for-fixed-channel-operation.patch openwrt: refresh patches 2020-08-02 00:32:10 +02:00
0015-hostapd-enter-DFS-state-if-no-available-channel-is-found.patch openwrt: backport DFS fixes (#2077) 2020-07-29 15:45:17 +02:00
0016-kernel-bridge-Implement-MLD-Querier-wake-up-calls-Android-bug-workaround.patch kernel: bridge: Implement MLD Querier wake-up calls / Android bug workaround 2020-10-08 20:06:24 +02:00
0017-mt76-mt7603-add-additional-EEPROM-chip-ID.patch mt76: mt7603: add additional EEPROM chip ID (#2133) 2020-10-17 13:58:45 +02:00
0018-ath79-Fix-fallback-to-bootloader-cmdline-on-empty-DT-bootargs.patch ath79: add support for Plasma Cloud PA300 2021-01-10 09:05:58 +01:00
0019-ath79-Add-support-for-Plasma-Cloud-PA300.patch ath79: add support for Plasma Cloud PA300 2021-01-10 09:05:58 +01:00
0020-ath79-Add-support-for-Plasma-Cloud-PA300E.patch ath79: add support for Plasma Cloud PA300E 2021-01-10 09:06:02 +01:00
0021-ipq40xx-Change-name-for-openmesh.sh-to-vendor-free-name.patch ipq40xx: add support for Plasma Cloud PA1200 2021-01-13 08:28:12 +01:00
0022-ipq40xx-add-support-for-Plasma-Cloud-PA1200.patch ipq40xx: add support for Plasma Cloud PA1200 2021-01-13 08:28:12 +01:00
0023-ipq40xx-add-support-for-Plasma-Cloud-PA2200.patch ipq40xx: add support for Plasma Cloud PA2200 2021-01-13 08:28:12 +01:00
0024-kernel-bridge-Fix-a-deadlock-when-enabling-multicast-snooping.patch kernel: bridge: Fix a deadlock when enabling multicast snooping 2021-01-25 03:16:06 +01:00