BNX2: fix a Null Pointer for stats_blk
authorwangweidong <wangweidong1@huawei.com>
Thu, 8 Oct 2015 10:03:47 +0000 (18:03 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 11 Oct 2015 12:06:21 +0000 (05:06 -0700)
commit8fae307c8fe9789ff1f4161dcb2db0d689069448
tree96e0afa810063f8fc6e8ac0d4e83ec2985b01aea
parente446f9dfe17bbaa76a1fe22912636f38be1e1af8
BNX2: fix a Null Pointer for stats_blk

we have two processes to do:
P1#: ifconfig eth0 down; which will call bnx2_close, then will
, and set Null to stats_blk
P2#: ifconfig eth0; which will call bnx2_get_stats64, it will
use stats_blk.
In one case:
    --P1#--                   --P2#--
                              stats_blk(no null)
    bnx2_free_mem
    ->bp->stats_blk = NULL
                              GET_64BIT_NET_STATS

then it will cause 'NULL Pointer' Problem.
it is as well with 'ethtool -S ethx'.

Allocate the statistics block at probe time so that this problem is
impossible

Signed-off-by: Wang Weidong <wangweidong1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnx2.c
drivers/net/ethernet/broadcom/bnx2.h