linux_dsm_epyc7002/drivers/net
Kloetzke Jan ad70411a97 usbnet: fix kernel crash after disconnect
When disconnecting cdc_ncm the kernel sporadically crashes shortly
after the disconnect:

  [   57.868812] Unable to handle kernel NULL pointer dereference at virtual address 00000000
  ...
  [   58.006653] PC is at 0x0
  [   58.009202] LR is at call_timer_fn+0xec/0x1b4
  [   58.013567] pc : [<0000000000000000>] lr : [<ffffff80080f5130>] pstate: 00000145
  [   58.020976] sp : ffffff8008003da0
  [   58.024295] x29: ffffff8008003da0 x28: 0000000000000001
  [   58.029618] x27: 000000000000000a x26: 0000000000000100
  [   58.034941] x25: 0000000000000000 x24: ffffff8008003e68
  [   58.040263] x23: 0000000000000000 x22: 0000000000000000
  [   58.045587] x21: 0000000000000000 x20: ffffffc68fac1808
  [   58.050910] x19: 0000000000000100 x18: 0000000000000000
  [   58.056232] x17: 0000007f885aff8c x16: 0000007f883a9f10
  [   58.061556] x15: 0000000000000001 x14: 000000000000006e
  [   58.066878] x13: 0000000000000000 x12: 00000000000000ba
  [   58.072201] x11: ffffffc69ff1db30 x10: 0000000000000020
  [   58.077524] x9 : 8000100008001000 x8 : 0000000000000001
  [   58.082847] x7 : 0000000000000800 x6 : ffffff8008003e70
  [   58.088169] x5 : ffffffc69ff17a28 x4 : 00000000ffff138b
  [   58.093492] x3 : 0000000000000000 x2 : 0000000000000000
  [   58.098814] x1 : 0000000000000000 x0 : 0000000000000000
  ...
  [   58.205800] [<          (null)>]           (null)
  [   58.210521] [<ffffff80080f5298>] expire_timers+0xa0/0x14c
  [   58.215937] [<ffffff80080f542c>] run_timer_softirq+0xe8/0x128
  [   58.221702] [<ffffff8008081120>] __do_softirq+0x298/0x348
  [   58.227118] [<ffffff80080a6304>] irq_exit+0x74/0xbc
  [   58.232009] [<ffffff80080e17dc>] __handle_domain_irq+0x78/0xac
  [   58.237857] [<ffffff8008080cf4>] gic_handle_irq+0x80/0xac
  ...

The crash happens roughly 125..130ms after the disconnect. This
correlates with the 'delay' timer that is started on certain USB tx/rx
errors in the URB completion handler.

The problem is a race of usbnet_stop() with usbnet_start_xmit(). In
usbnet_stop() we call usbnet_terminate_urbs() to cancel all URBs in
flight. This only makes sense if no new URBs are submitted
concurrently, though. But the usbnet_start_xmit() can run at the same
time on another CPU which almost unconditionally submits an URB. The
error callback of the new URB will then schedule the timer after it was
already stopped.

The fix adds a check if the tx queue is stopped after the tx list lock
has been taken. This should reliably prevent the submission of new URBs
while usbnet_terminate_urbs() does its job. The same thing is done on
the rx side even though it might be safe due to other flags that are
checked there.

Signed-off-by: Jan Klötzke <Jan.Kloetzke@preh.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-21 13:46:23 -07:00
..
appletalk
arcnet
bonding bonding: fix arp_validate toggling in active-backup mode 2019-05-13 09:43:46 -07:00
caif
can
dsa net: dsa: sja1105: Don't return a negative in u8 sja1105_stp_state_get 2019-05-08 13:57:50 -07:00
ethernet net: stmmac: dma channel control register need to be init first 2019-05-20 20:55:39 -04:00
fddi fddi: fix typos in code comments 2019-05-20 20:21:22 -04:00
fjes
hamradio
hippi
hyperv Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-05-07 17:22:09 -07:00
ieee802154 One more patch to remove io.h from clk-provider.h. We used to need this 2019-05-16 19:05:35 -07:00
ipvlan
netdevsim netdevsim: Make nsim_num_vf static 2019-05-05 10:48:45 -07:00
phy net: phylink: ensure inband AN works correctly 2019-05-21 13:11:54 -07:00
plip
ppp ppp: deflate: Fix possible crash in deflate_init 2019-05-14 15:41:55 -07:00
slip slip: make slhc_free() silently accept an error pointer 2019-04-26 18:19:09 -07:00
team genetlink: optionally validate strictly/dumps 2019-04-27 17:07:22 -04:00
usb usbnet: fix kernel crash after disconnect 2019-05-21 13:46:23 -07:00
vmxnet3
wan
wimax wimax/i2400m: use struct_size() helper 2019-05-04 00:04:31 -04:00
wireless net: wireless: mt76: fix similar warning reported by kbuild test robot 2019-05-10 15:14:29 -07:00
xen-netback
dummy.c
eql.c
geneve.c
gtp.c genetlink: optionally validate strictly/dumps 2019-04-27 17:07:22 -04:00
ifb.c
Kconfig
LICENSE.SRC
loopback.c
macsec.c genetlink: optionally validate strictly/dumps 2019-04-27 17:07:22 -04:00
macvlan.c macvlan: Mark expected switch fall-through 2019-05-20 11:37:41 -07:00
macvtap.c
Makefile net: Always descend into dsa/ 2019-05-14 15:20:11 -07:00
mdio.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 tuntap: synchronize through tfiles array instead of tun->numqueues 2019-05-09 09:21:42 -07:00
veth.c
virtio_net.c
vrf.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-04-25 23:52:29 -04:00
vsockmon.c
vxlan.c
xen-netfront.c