Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cnic: Fix crash in cnic_bnx2x_service_kcq()

commit 104a43edb264321a4d41850e98153b4fa8a9ef42
cnic: Use CHIP_NUM macros from bnx2x.h

changed the code to use the bnx2x macro NO_FCOE() to determine if FCoE
is supported or not. There is another place in cnic that is still using
the old method to determine if FCoE is supported or not. The 2 methods
may not yield the same result after the network interface is brought down
and up. This will cause the crash as cnic_bnx2x_service_kcq() will access
the uninitialized cp->kcq2.

The fix is to consistently use the same macro CNIC_SUPPORTS_FCOE() which
uses the bnx2x NO_FCOE() macro. As a follow-up, we can clean up the code
to remove the old method as it is no longer needed.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Michael Chan and committed by
David S. Miller
48a30569 f78afb35

+2 -1
+2 -1
drivers/net/ethernet/broadcom/cnic.c
··· 3135 3135 { 3136 3136 struct cnic_dev *dev = (struct cnic_dev *) data; 3137 3137 struct cnic_local *cp = dev->cnic_priv; 3138 + struct bnx2x *bp = netdev_priv(dev->netdev); 3138 3139 u32 status_idx, new_status_idx; 3139 3140 3140 3141 if (unlikely(!test_bit(CNIC_F_CNIC_UP, &dev->flags))) ··· 3147 3146 CNIC_WR16(dev, cp->kcq1.io_addr, 3148 3147 cp->kcq1.sw_prod_idx + MAX_KCQ_IDX); 3149 3148 3150 - if (cp->ethdev->drv_state & CNIC_DRV_STATE_NO_FCOE) { 3149 + if (!CNIC_SUPPORTS_FCOE(bp)) { 3151 3150 cp->arm_int(dev, status_idx); 3152 3151 break; 3153 3152 }