diff options
author | Michael Chan <mchan@broadcom.com> | 2010-12-23 03:38:30 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-12-23 14:44:32 -0500 |
commit | eaaa6e9c222d5c398488ed4216f0fd94e4b81759 (patch) | |
tree | 29b51c0a45c5bda5d871f1c59f66d463fa6bc588 | |
parent | 4aacb7afb6afd78efe26427e74fa56a5fc72fad3 (diff) |
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>
-rw-r--r-- | drivers/net/cnic.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c index bf4a804e4787..1240deaf2420 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) | |||
2352 | static int cnic_service_bnx2(void *data, void *status_blk) | 2352 | static int cnic_service_bnx2(void *data, void *status_blk) |
2353 | { | 2353 | { |
2354 | struct cnic_dev *dev = data; | 2354 | struct cnic_dev *dev = data; |
2355 | struct cnic_local *cp = dev->cnic_priv; | ||
2356 | u32 status_idx = *cp->kcq1.status_idx_ptr; | ||
2357 | 2355 | ||
2358 | if (unlikely(!test_bit(CNIC_F_CNIC_UP, &dev->flags))) | 2356 | if (unlikely(!test_bit(CNIC_F_CNIC_UP, &dev->flags))) { |
2359 | return status_idx; | 2357 | struct status_block *sblk = status_blk; |
2358 | |||
2359 | return sblk->status_idx; | ||
2360 | } | ||
2360 | 2361 | ||
2361 | return cnic_service_bnx2_queues(dev); | 2362 | return cnic_service_bnx2_queues(dev); |
2362 | } | 2363 | } |
@@ -2375,9 +2376,10 @@ static void cnic_service_bnx2_msix(unsigned long data) | |||
2375 | static void cnic_doirq(struct cnic_dev *dev) | 2376 | static void cnic_doirq(struct cnic_dev *dev) |
2376 | { | 2377 | { |
2377 | struct cnic_local *cp = dev->cnic_priv; | 2378 | struct cnic_local *cp = dev->cnic_priv; |
2378 | u16 prod = cp->kcq1.sw_prod_idx & MAX_KCQ_IDX; | ||
2379 | 2379 | ||
2380 | if (likely(test_bit(CNIC_F_CNIC_UP, &dev->flags))) { | 2380 | if (likely(test_bit(CNIC_F_CNIC_UP, &dev->flags))) { |
2381 | u16 prod = cp->kcq1.sw_prod_idx & MAX_KCQ_IDX; | ||
2382 | |||
2381 | prefetch(cp->status_blk.gen); | 2383 | prefetch(cp->status_blk.gen); |
2382 | prefetch(&cp->kcq1.kcq[KCQ_PG(prod)][KCQ_IDX(prod)]); | 2384 | prefetch(&cp->kcq1.kcq[KCQ_PG(prod)][KCQ_IDX(prod)]); |
2383 | 2385 | ||