linux-stable/drivers/net
Florian Fainelli 7cb6a2a2c7 net: systemport: Protect stop from timeout
A timing hazard exists when the network interface is stopped that
allows a watchdog timeout to be processed by a separate core in
parallel. This creates the potential for the timeout handler to
wake the queues while the driver is shutting down, or access
registers after their clocks have been removed.

The more common case is that the watchdog timeout will produce a
warning message which doesn't lead to a crash. The chances of this
are greatly increased by the fact that bcm_sysport_netif_stop stops
the transmit queues which can easily precipitate a watchdog time-
out because of stale trans_start data in the queues.

This commit corrects the behavior by ensuring that the watchdog
timeout is disabled before enterring bcm_sysport_netif_stop. There
are currently only two users of the bcm_sysport_netif_stop function:
close and suspend.

The close case already handles the issue by exiting the RUNNING
state before invoking the driver close service.

The suspend case now performs the netif_device_detach to exit the
PRESENT state before the call to bcm_sysport_netif_stop rather than
after it.

These behaviors prevent any future scheduling of the driver timeout
service during the window. The netif_tx_stop_all_queues function
in bcm_sysport_netif_stop is replaced with netif_tx_disable to ensure
synchronization with any transmit or timeout threads that may
already be executing on other cores.

For symmetry, the netif_device_attach call upon resume is moved to
after the call to bcm_sysport_netif_start. Since it wakes the transmit
queues it is not necessary to invoke netif_tx_start_all_queues from
bcm_sysport_netif_start so it is moved into the driver open service.

Fixes: 40755a0fce ("net: systemport: add suspend and resume support")
Fixes: 80105befdb ("net: systemport: add Broadcom SYSTEMPORT Ethernet MAC driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-11-03 00:03:40 -07:00
..
appletalk
arcnet mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
bonding bonding: fix length of actor system 2018-10-29 20:39:38 -07:00
caif
can
dsa net: dsa: microchip: initialize mutex before use 2018-11-02 23:56:34 -07:00
ethernet net: systemport: Protect stop from timeout 2018-11-03 00:03:40 -07:00
fddi FDDI: defza: Support capturing outgoing SMT traffic 2018-10-15 21:46:06 -07:00
fjes
hamradio Merge branch 'work.tty-ioctl' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-10-24 14:43:41 +01:00
hippi
hyperv hv_netvsc: fix vf serial matching with pci slot info 2018-10-15 22:58:11 -07:00
ieee802154
ipvlan
netdevsim
phy net: phy: genphy_10g_driver: Avoid NULL pointer dereference 2018-10-25 16:19:09 -07:00
plip
ppp Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2018-10-25 16:43:35 -07:00
slip change semantics of ldisc ->compat_ioctl() 2018-10-13 00:50:53 -04:00
team netpoll: allow cleanup to be synchronous 2018-10-19 17:01:43 -07:00
usb usbnet: smsc95xx: disable carrier check while suspending 2018-11-02 23:49:15 -07:00
vmxnet3
wan Merge branch 'work.tty-ioctl' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-10-24 14:43:41 +01:00
wimax
wireless Merge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git 2018-10-14 12:21:43 +03:00
xen-netback
dummy.c
eql.c
geneve.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-10-19 11:03:06 -07:00
gtp.c
ifb.c
Kconfig
LICENSE.SRC
loopback.c net: loopback: clear skb->tstamp before netif_rx() 2018-10-20 01:01:28 -07:00
macsec.c macsec: let the administrator set UP state even if lowerdev is down 2018-10-28 19:26:42 -07:00
macvlan.c netpoll: allow cleanup to be synchronous 2018-10-19 17:01:43 -07:00
macvtap.c
Makefile
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 tun: Consistently configure generic netdev params via rtnetlink 2018-10-15 21:40:31 -07:00
veth.c veth: Add ethtool statistics support for XDP 2018-10-15 21:58:46 -07:00
virtio_net.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-10-19 11:03:06 -07:00
vrf.c
vsockmon.c
vxlan.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-10-19 11:03:06 -07:00
xen-netfront.c