Skip to content

net: avoid nested UP notifier events

Jakub Kicinski netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 10 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4net: turn the rx_mode work into a generic netdev_work facilityinclude/linux/netdevice.h net/core/Makefile net/core/dev.c +3 more+138 -803 replies
2/4net: add the driver-facing netdev_work scheduling APIinclude/linux/netdevice.h net/core/netdev_work.c+74 -182 replies
3/4vlan: defer real device state propagation to netdev_workDocumentation/networking/netdevices.rst net/8021q/vlan.c net/8021q/vlan.h +2 more+82 -683 replies
4/4selftests: bonding: add a test for VLAN propagation over a bonded real devicetools/testing/selftests/drivers/net/bonding/Makefile tools/testing/selftests/drivers/net/bonding/bond_vlan_real_dev.sh+181 -02 replies

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchKuniyuki IwashimaAleksandr LoktionovNicolai BuchwitzStanislav Fomichev
1/4R-b A-b
2/4R-b A-b
3/4R-b R-b A-b
4/4R-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v1 thread

Cover letter [PATCH net 0/4] net: avoid nested UP notifier events

syzbot reported that recent ethtool rework leads to deadlock on stacked devices. VLANs create nested notifications, confusing execution context. Bringing up dummy causes vlan to bring itself up as well. Which in turn causes bond to ask for link state - a call chain traveling in the opposite direction.

bond (3) bond_update_speed_duplex(vlan)
| ^ v
vlan (2) UP(vlan) (4) vlan_ethtool_get_link_ksettings()
| ^ v
dummy (1) UP(dummy) (5) __ethtool_get_link_ksettings()

We locked the instance lock of dummy at (1) and will will try to lock it again at (5) - which of course deadlocks.

For non-nested notifications this is avoided because NETDEV_UP is always run ops-locked (so that bond asks for link using the netif_ API which assumes instance lock already held). The nesting, however, makes this problematic, we cannot carry the state of the whole chain back in the opposite direction.

AFAICT vlan is the only driver which causes such issues. So let's try a localized fix of deferring vlan auto-open to a workqueue.

Jakub Kicinski (4):
net: turn the rx_mode work into a generic netdev_work facility
net: add the driver-facing netdev_work scheduling API
vlan: defer real device state propagation to netdev_work
selftests: bonding: add a test for VLAN propagation over a bonded real
device

 Documentation/networking/netdevices.rst       |   2 +
 net/core/Makefile                             |   2 +-
 .../selftests/drivers/net/bonding/Makefile    |   1 +
 include/linux/netdevice.h                     |  21 +-
 net/8021q/vlan.h                              |  11 ++
 net/core/dev.h                                |  11 +-
 net/8021q/vlan.c                              |  76 +-------
 net/8021q/vlan_dev.c                          |  60 ++++++
 net/core/dev.c                                |   2 +
 net/core/dev_addr_lists.c                     |  77 +-------
 net/core/netdev_work.c                        | 162 ++++++++++++++++
 .../drivers/net/bonding/bond_vlan_real_dev.sh | 180 ++++++++++++++++++
 12 files changed, 457 insertions(+), 148 deletions(-)
 create mode 100644 net/core/netdev_work.c
 create mode 100755 tools/testing/selftests/drivers/net/bonding/bond_vlan_real_dev.sh
Signature · 1 line
2.54.0