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] [thread-next>] [day] [month] [year] [list]
Message-ID: <1368637587-13391-2-git-send-email-fabio.estevam@freescale.com>
Date:	Wed, 15 May 2013 14:06:27 -0300
From:	Fabio Estevam <fabio.estevam@...escale.com>
To:	<davem@...emloft.net>
CC:	<shawn.guo@...aro.org>, <Frank.Li@...escale.com>,
	<kernel@...gutronix.de>, <eric.dumazet@...il.com>,
	<netdev@...r.kernel.org>,
	Fabio Estevam <fabio.estevam@...escale.com>
Subject: [PATCH 2/2] fec: Invert the order of function calls in fec_restart()

commit 54309fa6 ("net: fec: fix kernel oops when plug/unplug cable many times")
introduced the following 'if' block in the beginning of fec_start():

	if (netif_running(ndev)) {
		netif_device_detach(ndev);
		napi_disable(&fep->napi);
		netif_stop_queue(ndev);
		netif_tx_lock_bh(ndev);
	}

Then later in the end of fec_restart() there is another block that calls the
opposite of each one of these functions.

The correct approach would be to also call them with in the reverse order, so 
that we have as result:

	if (netif_running(ndev)) {
		netif_tx_unlock_bh(ndev);
		netif_wake_queue(ndev);
		napi_enable(&fep->napi);
		netif_device_attach(ndev);
	}

Suggested-by: Eric Dumazet <eric.dumazet@...il.com>
Signed-off-by: Fabio Estevam <fabio.estevam@...escale.com>
---
 drivers/net/ethernet/freescale/fec_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 658fbc1..570dfad 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -616,10 +616,10 @@ fec_restart(struct net_device *ndev, int duplex)
 	writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
 
 	if (netif_running(ndev)) {
-		netif_device_attach(ndev);
-		napi_enable(&fep->napi);
-		netif_wake_queue(ndev);
 		netif_tx_unlock_bh(ndev);
+		netif_wake_queue(ndev);
+		napi_enable(&fep->napi);
+		netif_device_attach(ndev);
 	}
 }
 
-- 
1.8.1.2


--
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