lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1367179906.6971.36.camel@deadeye.wl.decadent.org.uk>
Date:	Sun, 28 Apr 2013 21:11:46 +0100
From:	Ben Hutchings <bhutchings@...arflare.com>
To:	Frank Li <Frank.Li@...escale.com>
CC:	<romieu@...zoreil.com>, <r.schwebel@...gutronix.de>,
	<davem@...emloft.net>, <l.stach@...gutronix.de>,
	<netdev@...r.kernel.org>, <festevam@...il.com>,
	<shawn.guo@...aro.org>, <lznuaa@...il.com>
Subject: Re: [PATCH 1/1] net: fec: fix kernel oops when plug/unplug cable
 many times

On Sun, 2013-04-28 at 11:04 +0800, Frank Li wrote:
> 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@...escale.com>
> ---
>  drivers/net/ethernet/freescale/fec.c |   39 ++++++++++++++++++++++++++++-----
>  drivers/net/ethernet/freescale/fec.h |    3 +-
>  2 files changed, 35 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
> index 73195f6..9128a3c 100644
> --- a/drivers/net/ethernet/freescale/fec.c
> +++ b/drivers/net/ethernet/freescale/fec.c
> @@ -403,6 +403,11 @@ fec_restart(struct net_device *ndev, int duplex)
>  	const struct platform_device_id *id_entry =
>  				platform_get_device_id(fep->pdev);
>  	int i;
> +	if (netif_running(ndev)) {
> +		napi_disable(&fep->napi);
> +		netif_stop_queue(ndev);
> +	}
[...]

I would advise against calling netif_stop_queue() outside of the TX path
(for reasons explained in commit 29c69a488264).  If you're sure the
carrier state is off at this point, it should be OK, though.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ