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>] [day] [month] [year] [list]
Message-Id: <1305677781-16768-1-git-send-email-prasanna.panchamukhi@riverbed.com>
Date:	Tue, 17 May 2011 17:16:21 -0700
From:	prasanna.panchamukhi@...erbed.com
To:	bruce.w.allan@...el.com, jeffrey.t.kirsher@...el.com,
	jesse.brandeburg@...el.com
Cc:	e1000-devel@...ts.sourceforge.net, netdev@...r.kernel.org,
	prasanna.panchamukhi@...erbed.com
Subject: [PATCH] e100: Don't enable interrupts while exiting polling

Interrupts remain enabled while exiting the e100_poll(), when the driver is
down. Anything bad can happen resulting in a crash.
The solution is not to enable the interrupts while the driver is down.

Signed-off-by: Prasanna S. Panchamukhi <prasanna.panchamukhi@...erbed.com>
---
 drivers/net/e100.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index abbf229..479219f 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -426,6 +426,7 @@ enum cb_command {
 };
 
 enum e100_state_t {
+	__E100_DOWN,
 	__E100_TESTING
 };
 
@@ -2177,7 +2178,8 @@ static int e100_poll(struct napi_struct *napi, int budget)
 	/* If budget not fully consumed, exit the polling mode */
 	if (work_done < budget) {
 		napi_complete(napi);
-		e100_enable_irq(nic);
+		if (!test_bit(__E100_DOWN, &nic->state))
+			e100_enable_irq(nic);
 	}
 
 	return work_done;
@@ -2230,6 +2232,7 @@ static int e100_up(struct nic *nic)
 {
 	int err;
 
+	clear_bit(__E100_DOWN, &nic->state);
 	if ((err = e100_rx_alloc_list(nic)))
 		return err;
 	if ((err = e100_alloc_cbs(nic)))
@@ -2242,6 +2245,7 @@ static int e100_up(struct nic *nic)
 	if ((err = request_irq(nic->pdev->irq, e100_intr, IRQF_SHARED,
 		nic->netdev->name, nic->netdev)))
 		goto err_no_irq;
+	set_bit(__E100_DOWN, &nic->state);
 	netif_wake_queue(nic->netdev);
 	napi_enable(&nic->napi);
 	/* enable ints _after_ enabling poll, preventing a race between
@@ -2917,7 +2921,9 @@ err_out_free_dev:
 static void __devexit e100_remove(struct pci_dev *pdev)
 {
 	struct net_device *netdev = pci_get_drvdata(pdev);
+	struct nic *nic = netdev_priv(netdev);
 
+	set_bit(__E100_DOWN, &nic->state);
 	if (netdev) {
 		struct nic *nic = netdev_priv(netdev);
 		unregister_netdev(netdev);
-- 
1.7.0.4

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