]> www.infradead.org Git - users/jedix/linux-maple.git/commit
cnic: Fix occasional NULL pointer dereference during reboot.
authorJoe Jin <joe.jin@oracle.com>
Mon, 27 Aug 2012 11:06:14 +0000 (19:06 +0800)
committerJoe Jin <joe.jin@oracle.com>
Tue, 28 Aug 2012 07:23:15 +0000 (15:23 +0800)
commit652470062df94a5d6222f5ff00497b9b52716e27
treeb8225d6dc942c50d3a0af9e3daf4a959d95b4be9
parent980e50d19d0605301cab4f8ddf9eae0cced4027f
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.

(backported from upstream commit a2028b2376a858cb68a7fcc129f6508f59b45381)
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
drivers/net/cnic.c