linux/drivers/net
Ben Hutchings 283e38db65 sh_eth: Fix serialisation of interrupt disable with interrupt & NAPI handlers
In order to stop the RX path accessing the RX ring while it's being
stopped or resized, we clear the interrupt mask (EESIPR) and then call
free_irq() or synchronise_irq().  This is insufficient because the
interrupt handler or NAPI poller may set EESIPR again after we clear
it.  Also, in sh_eth_set_ringparam() we currently don't disable NAPI
polling at all.

I could easily trigger a crash by running the loop:

   while ethtool -G eth0 rx 128 && ethtool -G eth0 rx 64; do echo -n .; done

and 'ping -f' toward the sh_eth port from another machine.

To fix this:
- Add a software flag (irq_enabled) to signal whether interrupts
  should be enabled
- In the interrupt handler, if the flag is clear then clear EESIPR
  and return
- In the NAPI poller, if the flag is clear then don't set EESIPR
- Set the flag before enabling interrupts in sh_eth_dev_init() and
  sh_eth_set_ringparam()
- Clear the flag and serialise with the interrupt and NAPI
  handlers before clearing EESIPR in sh_eth_close() and
  sh_eth_set_ringparam()

After this, I could run the loop for 100,000 iterations successfully.

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-01-26 16:13:15 -08:00
..
appletalk net: better IFF_XMIT_DST_RELEASE support 2014-10-07 13:22:11 -04:00
arcnet
bonding bonding: change error message to debug message in __bond_release_one() 2014-12-27 02:20:55 -05:00
caif caif: Fix napi poll list corruption 2014-12-22 16:34:39 -05:00
can can: c_can: end pending transmission on network stop (ifdown) 2015-01-21 22:43:14 +01:00
cris
dsa net: dsa: bcm_sf2: always select FIXED_PHY 2014-12-16 00:57:07 -05:00
ethernet sh_eth: Fix serialisation of interrupt disable with interrupt & NAPI handlers 2015-01-26 16:13:15 -08:00
fddi defxx: Clean up DEFEA resource management 2014-11-21 16:37:13 -05:00
hamradio hamradio: 6pack: remove unnecessary check 2014-11-03 15:34:31 -05:00
hippi
hyperv hyperv: Fix some variable name typos in send-buffer init/revoke 2014-12-22 16:11:11 -05:00
ieee802154 Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
ipvlan ipvlan: fix incorrect usage of IS_ERR() macro in IPv6 code path. 2015-01-25 00:24:19 -08:00
irda Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
phy net: phy: micrel: use generic config_init for KSZ8021/KSZ8031 2014-12-26 16:19:50 -05:00
plip
ppp ppp_read(): switch to skb_copy_datagram_iter() 2014-12-09 16:29:10 -05:00
slip
team team: avoid possible underflow of count_pending value for notify_peers and mcast_rejoin 2015-01-14 16:53:57 -05:00
usb r8152: remove sram_read 2015-01-19 16:16:32 -05:00
vmxnet3 ethtool: Support for configurable RSS hash function 2014-12-08 21:07:10 -05:00
wan net: better IFF_XMIT_DST_RELEASE support 2014-10-07 13:22:11 -04:00
wimax
wireless ath9k: fix race condition in irq processing during hardware reset 2015-01-19 14:32:29 +02:00
xen-netback xen-netback: fixing the propagation of the transmit shaper timeout 2015-01-06 14:17:37 -05:00
dummy.c dummy: use MODULE_VERSION 2014-12-09 21:51:06 -05:00
eql.c net: better IFF_XMIT_DST_RELEASE support 2014-10-07 13:22:11 -04:00
ifb.c net: better IFF_XMIT_DST_RELEASE support 2014-10-07 13:22:11 -04:00
Kconfig ipvlan: ipvlan depends on INET and IPV6 2014-11-29 20:53:05 -08:00
LICENSE.SRC
loopback.c net: better IFF_XMIT_DST_RELEASE support 2014-10-07 13:22:11 -04:00
macvlan.c macvlan: play well with ipvlan device 2014-12-09 16:10:06 -05:00
macvtap.c macvtap: drop broken IFF_VNET_LE 2014-12-16 11:19:42 -05:00
Makefile ipvlan: Initial check-in of the IPVLAN driver. 2014-11-24 15:29:18 -05:00
mdio.c
mii.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c
sungem_phy.c
tun.c tun: drop broken IFF_VNET_LE 2014-12-16 11:19:41 -05:00
veth.c
virtio_net.c virtio_net: Fix napi poll list corruption 2014-12-22 16:10:12 -05:00
vxlan.c vxlan: Fix double free of skb. 2014-12-23 23:57:31 -05:00
xen-netfront.c xen-netfront: use different locks for Rx and Tx stats 2015-01-13 17:22:11 -05:00