linux/drivers/net
Xin Long ae42cc62a9 bonding: move dev_mc_sync after master_upper_dev_link in bond_enslave
Beniamino found a crash when adding vlan as slave of bond which is also
the parent link:

  ip link add bond1 type bond
  ip link set bond1 up
  ip link add link bond1 vlan1 type vlan id 80
  ip link set vlan1 master bond1

The call trace is as below:

  [<ffffffffa850842a>] queued_spin_lock_slowpath+0xb/0xf
  [<ffffffffa8515680>] _raw_spin_lock+0x20/0x30
  [<ffffffffa83f6f07>] dev_mc_sync+0x37/0x80
  [<ffffffffc08687dc>] vlan_dev_set_rx_mode+0x1c/0x30 [8021q]
  [<ffffffffa83efd2a>] __dev_set_rx_mode+0x5a/0xa0
  [<ffffffffa83f7138>] dev_mc_sync_multiple+0x78/0x80
  [<ffffffffc084127c>] bond_enslave+0x67c/0x1190 [bonding]
  [<ffffffffa8401909>] do_setlink+0x9c9/0xe50
  [<ffffffffa8403bf2>] rtnl_newlink+0x522/0x880
  [<ffffffffa8403ff7>] rtnetlink_rcv_msg+0xa7/0x260
  [<ffffffffa8424ecb>] netlink_rcv_skb+0xab/0xc0
  [<ffffffffa83fe498>] rtnetlink_rcv+0x28/0x30
  [<ffffffffa8424850>] netlink_unicast+0x170/0x210
  [<ffffffffa8424bf8>] netlink_sendmsg+0x308/0x420
  [<ffffffffa83cc396>] sock_sendmsg+0xb6/0xf0

This is actually a dead lock caused by sync slave hwaddr from master when
the master is the slave's 'slave'. This dead loop check is actually done
by netdev_master_upper_dev_link. However, Commit 1f718f0f4f ("bonding:
populate neighbour's private on enslave") moved it after dev_mc_sync.

This patch is to fix it by moving dev_mc_sync after master_upper_dev_link,
so that this loop check would be earlier than dev_mc_sync. It also moves
if (mode == BOND_MODE_8023AD) into if (!bond_uses_primary) clause as an
improvement.

Note team driver also has this issue, I will fix it in another patch.

Fixes: 1f718f0f4f ("bonding: populate neighbour's private on enslave")
Reported-by: Beniamino Galvani <bgalvani@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-03-26 12:51:05 -04:00
..
appletalk
arcnet
bonding bonding: move dev_mc_sync after master_upper_dev_link in bond_enslave 2018-03-26 12:51:05 -04:00
caif net: caif: remove redundant re-assignment of pointer pfrm 2018-01-22 10:51:56 -05:00
can can: cc770: Fix use after free in cc770_tx_interrupt() 2018-03-19 10:57:29 +01:00
cris
dsa net: dsa: Fix functional dsa-loop dependency on FIXED_PHY 2018-03-22 13:02:47 -04:00
ethernet mlxsw: spectrum_router: Handle MTU change of GRE netdevs 2018-03-23 12:54:34 -04:00
fddi
fjes
hamradio
hippi
hyperv hv_netvsc: common detach logic 2018-03-22 12:45:09 -04:00
ieee802154 vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
ipvlan
netdevsim netdevsim: fix overflow on the error path 2018-02-01 11:22:51 +01:00
phy net: phy: micrel: Use the general dummy stubs for MMD register access 2018-03-22 11:41:08 -04:00
plip
ppp ppp: avoid loop in xmit recursion detection code 2018-03-22 12:35:18 -04:00
slip
team team: Fix double free in error path 2018-03-08 11:19:52 -05:00
usb net: qmi_wwan: add BroadMobi BM806U 2020:2033 2018-03-26 12:35:42 -04:00
vmxnet3 vmxnet3: remove unused flag "rxcsum" from struct vmxnet3_adapter 2018-03-20 10:56:25 -04:00
wan hdlc_ppp: carrier detect ok, don't turn off negotiation 2018-02-26 14:38:12 -05:00
wimax treewide: Use DEVICE_ATTR_WO 2018-01-09 16:34:35 +01:00
wireless wireless-drivers fixes for 4.16 2018-03-25 21:26:07 -04:00
xen-netback
dummy.c
eql.c
geneve.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-01-29 10:15:51 -05:00
gtp.c
ifb.c
Kconfig
LICENSE.SRC
loopback.c
macsec.c macsec: missing dev_put() on error in macsec_newlink() 2018-03-22 14:30:36 -04:00
macvlan.c macvlan: filter out unsupported feature flags 2018-03-11 22:46:16 -04:00
macvtap.c
Makefile
mdio.c
mii.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
thunderbolt.c net: thunderbolt: Run disconnect flow asynchronously when logout is received 2018-02-12 12:03:04 -05:00
tun.c vhost_net: examine pointer types during un-producing 2018-03-09 12:02:59 -05:00
veth.c
virtio_net.c virtio-net: re enable XDP_REDIRECT for mergeable buffer 2018-03-04 22:16:36 -05:00
vrf.c net: vrf: Add support for sends to local broadcast address 2018-01-25 21:51:03 -05:00
vsockmon.c
vxlan.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-01-29 10:15:51 -05:00
xen-netfront.c xen-netfront: Fix hang on device removal 2018-02-28 20:20:08 +01:00