net: fec: fix kernel oops when plug/unplug cable many times
authorFrank Li <Frank.Li@freescale.com>
Tue, 7 May 2013 14:08:44 +0000 (14:08 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jun 2013 17:38:46 +0000 (10:38 -0700)
commitecfaafb3c1d177bf89123cead507f160b6005871
treea61a4db360d488b44b2bd50b019cd2ff525f894e
parentd609cfeee98ba6e95f41c2cf299744008c4d03da
net: fec: fix kernel oops when plug/unplug cable many times

[ Upstream commits 54309fa60b5f57b90c1842176f6045e665d21142 and
  3169134478a9638baf0dbb4fdca5a0718cbe8e27 ]

reproduce steps
 1. flood ping from other machine
  ping -f -s 41000 IP
 2. run below script
    while [ 1 ]; do ethtool -s eth0 autoneg off;
    sleep 3;ethtool -s eth0 autoneg on; sleep 4; done;

You can see oops in one hour.

The reason is fec_restart clear BD but NAPI may use it.
The solution is disable NAPI and stop xmit when reset BD.
disable NAPI may sleep, so fec_restart can't be call in
atomic context.

Signed-off-by: Frank Li <Frank.Li@freescale.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Tested-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/freescale/fec.c
drivers/net/ethernet/freescale/fec.h