]> git.baikalelectronics.ru Git - kernel.git/commit
cnic: Fix occasional NULL pointer dereference during reboot.
authorMichael Chan <mchan@broadcom.com>
Wed, 27 Jun 2012 15:08:19 +0000 (15:08 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 28 Jun 2012 04:20:08 +0000 (21:20 -0700)
commiteefaab62d78569194d6c3a9632d83d1e0225aa77
tree133b51113a4f2c9c9c741a1d21fd693477e7ddda
parent3694dd952eca7d4335db7cc0c7a54e01ba4f5971
cnic: Fix occasional NULL pointer dereference during reboot.

We register with bnx2x before we allocate ctx_tbl structure, so it is
possible for bnx2x to call cnic_ctl before the structure is allocated.
This can sometimes cause NULL pointer dereference of cp->ctx_tbl.  We
fix this by adding simple checking for valid state before proceeding.
The cnic_ctl call is RCU protected so we don't have to deal with race
conditions.

Because of the additional checking, we need to finish the shutdown
before clearing the CNIC_UP flag.

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