summaryrefslogtreecommitdiffstats
path: root/drivers/net/cnic.c
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2010-12-23 08:38:30 +0000
committerDavid S. Miller <davem@davemloft.net>2010-12-23 11:44:32 -0800
commiteaaa6e9c222d5c398488ed4216f0fd94e4b81759 (patch)
tree29b51c0a45c5bda5d871f1c59f66d463fa6bc588 /drivers/net/cnic.c
parent4aacb7afb6afd78efe26427e74fa56a5fc72fad3 (diff)
downloadop-kernel-dev-eaaa6e9c222d5c398488ed4216f0fd94e4b81759.zip
op-kernel-dev-eaaa6e9c222d5c398488ed4216f0fd94e4b81759.tar.gz
cnic: Check device state before reading the kcq pointer in IRQ
If the device is down, the kcq pointer may be NULL. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cnic.c')
-rw-r--r--drivers/net/cnic.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index bf4a804..1240dea 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -2352,11 +2352,12 @@ static u32 cnic_service_bnx2_queues(struct cnic_dev *dev)
static int cnic_service_bnx2(void *data, void *status_blk)
{
struct cnic_dev *dev = data;
- struct cnic_local *cp = dev->cnic_priv;
- u32 status_idx = *cp->kcq1.status_idx_ptr;
- if (unlikely(!test_bit(CNIC_F_CNIC_UP, &dev->flags)))
- return status_idx;
+ if (unlikely(!test_bit(CNIC_F_CNIC_UP, &dev->flags))) {
+ struct status_block *sblk = status_blk;
+
+ return sblk->status_idx;
+ }
return cnic_service_bnx2_queues(dev);
}
@@ -2375,9 +2376,10 @@ static void cnic_service_bnx2_msix(unsigned long data)
static void cnic_doirq(struct cnic_dev *dev)
{
struct cnic_local *cp = dev->cnic_priv;
- u16 prod = cp->kcq1.sw_prod_idx & MAX_KCQ_IDX;
if (likely(test_bit(CNIC_F_CNIC_UP, &dev->flags))) {
+ u16 prod = cp->kcq1.sw_prod_idx & MAX_KCQ_IDX;
+
prefetch(cp->status_blk.gen);
prefetch(&cp->kcq1.kcq[KCQ_PG(prod)][KCQ_IDX(prod)]);
OpenPOWER on IntegriCloud