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 <[email protected]>
---
 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


------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
E1000-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit 
http://communities.intel.com/community/wired

Reply via email to