linux-stable/drivers/net
Ivan Vecera b04683ff8f iavf: Fix hang during reboot/shutdown
Recent commit 974578017f ("iavf: Add waiting so the port is
initialized in remove") adds a wait-loop at the beginning of
iavf_remove() to ensure that port initialization is finished
prior unregistering net device. This causes a regression
in reboot/shutdown scenario because in this case callback
iavf_shutdown() is called and this callback detaches the device,
makes it down if it is running and sets its state to __IAVF_REMOVE.
Later shutdown callback of associated PF driver (e.g. ice_shutdown)
is called. That callback calls among other things sriov_disable()
that calls indirectly iavf_remove() (see stack trace below).
As the adapter state is already __IAVF_REMOVE then the mentioned
loop is end-less and shutdown process hangs.

The patch fixes this by checking adapter's state at the beginning
of iavf_remove() and skips the rest of the function if the adapter
is already in remove state (shutdown is in progress).

Reproducer:
1. Create VF on PF driven by ice or i40e driver
2. Ensure that the VF is bound to iavf driver
3. Reboot

[52625.981294] sysrq: SysRq : Show Blocked State
[52625.988377] task:reboot          state:D stack:    0 pid:17359 ppid:     1 f2
[52625.996732] Call Trace:
[52625.999187]  __schedule+0x2d1/0x830
[52626.007400]  schedule+0x35/0xa0
[52626.010545]  schedule_hrtimeout_range_clock+0x83/0x100
[52626.020046]  usleep_range+0x5b/0x80
[52626.023540]  iavf_remove+0x63/0x5b0 [iavf]
[52626.027645]  pci_device_remove+0x3b/0xc0
[52626.031572]  device_release_driver_internal+0x103/0x1f0
[52626.036805]  pci_stop_bus_device+0x72/0xa0
[52626.040904]  pci_stop_and_remove_bus_device+0xe/0x20
[52626.045870]  pci_iov_remove_virtfn+0xba/0x120
[52626.050232]  sriov_disable+0x2f/0xe0
[52626.053813]  ice_free_vfs+0x7c/0x340 [ice]
[52626.057946]  ice_remove+0x220/0x240 [ice]
[52626.061967]  ice_shutdown+0x16/0x50 [ice]
[52626.065987]  pci_device_shutdown+0x34/0x60
[52626.070086]  device_shutdown+0x165/0x1c5
[52626.074011]  kernel_restart+0xe/0x30
[52626.077593]  __do_sys_reboot+0x1d2/0x210
[52626.093815]  do_syscall_64+0x5b/0x1a0
[52626.097483]  entry_SYSCALL_64_after_hwframe+0x65/0xca

Fixes: 974578017f ("iavf: Add waiting so the port is initialized in remove")
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Link: https://lore.kernel.org/r/20220317104524.2802848-1-ivecera@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-03-17 09:37:37 -07:00
..
appletalk
arcnet net: arcnet: com20020: Fix null-ptr-deref in com20020pci_probe() 2022-03-03 10:29:13 +00:00
bonding bonding: force carrier update when releasing slave 2022-02-17 10:55:21 -08:00
caif virtio: wrap config->reset calls 2022-01-14 18:50:52 -05:00
can can: rcar_canfd: rcar_canfd_channel_probe(): register the CAN device when fully ready 2022-02-25 17:46:54 +01:00
dsa net: dsa: microchip: add spi_device_id tables 2022-03-14 10:08:08 +00:00
ethernet iavf: Fix hang during reboot/shutdown 2022-03-17 09:37:37 -07:00
fddi
fjes
hamradio drivers: hamradio: 6pack: fix UAF bug caused by mod_timer() 2022-02-18 10:58:17 +00:00
hippi
hyperv hv_netvsc: Add check for kvmalloc_array 2022-03-15 21:57:53 -07:00
ieee802154 net: ieee802154: ca8210: Fix lifs/sifs periods 2022-02-02 18:04:50 +01:00
ipa net: ipa: add an interconnect dependency 2022-03-02 22:14:05 -08:00
ipvlan
mctp mctp: serial: Cancel pending work from ndo_uninit handler 2022-02-11 14:39:54 -08:00
mdio net: mdio: mscc-miim: fix duplicate debugfs entry 2022-03-14 22:04:15 -07:00
netdevsim ipv6: fix data-race in fib6_info_hw_flags_set / fib6_purge_rt 2022-02-17 09:48:24 -08:00
pcs
phy net: phy: mscc: Add MODULE_FIRMWARE macros 2022-03-17 09:06:09 -07:00
plip
ppp
slip
team
usb smsc95xx: Ignore -ENODEV errors when device is unplugged 2022-03-07 12:32:31 +00:00
vmxnet3
wan
wireguard lib/crypto: blake2s: move hmac construction into wireguard 2022-01-18 13:03:55 +01:00
wireless Revert "ath10k: drop beacon and probe response which leak from other channel" 2022-03-16 13:34:52 +02:00
wwan net: wwan: Fix MRU mismatch issue which may lead to data connection lost 2022-01-15 22:40:52 +00:00
xen-netback Revert "xen-netback: Check for hotplug-status existence before watching" 2022-02-24 08:58:37 -08:00
amt.c
bareudp.c
dummy.c
eql.c
geneve.c
gtp.c
ifb.c
Kconfig
LICENSE.SRC
loopback.c
macsec.c net: macsec: Verify that send_sci is on when setting Tx sci explicitly 2022-02-01 20:32:20 -08:00
macvlan.c
macvtap.c
Makefile
mdio.c
mhi_net.c
mii.c
net_failover.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c
thunderbolt.c
tun.c
veth.c veth: fix races around rq->rx_notify_masked 2022-02-09 12:04:53 +00:00
virtio_net.c bitmap patches for 5.17-rc1 2022-01-23 06:20:44 +02:00
vrf.c
vsockmon.c
vxlan.c
xen-netfront.c xen/netfront: react properly to failing gnttab_end_foreign_access_ref() 2022-03-07 09:48:55 +01:00