diff options
author | YueHaibing <yuehaibing@huawei.com> | 2018-05-22 09:07:18 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-05-25 03:52:44 +0200 |
commit | d624613e422d9bda9e4f066281b1f178ed51f0b1 (patch) | |
tree | 3f773841aae53269b72730d3aae15a3d1290fab6 /drivers/net/ethernet/chelsio | |
parent | net: phy: replace bool members in struct phy_device with bit-fields (diff) | |
download | linux-d624613e422d9bda9e4f066281b1f178ed51f0b1.tar.xz linux-d624613e422d9bda9e4f066281b1f178ed51f0b1.zip |
cxgb4: Check for kvzalloc allocation failure
t4_prep_fw doesn't check for card_fw pointer before store the read data,
which could lead to a NULL pointer dereference if kvzalloc failed.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/chelsio')
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 513e1d356384..8405187f8e3f 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c @@ -4140,6 +4140,10 @@ static int adap_init0(struct adapter *adap) * card */ card_fw = kvzalloc(sizeof(*card_fw), GFP_KERNEL); + if (!card_fw) { + ret = -ENOMEM; + goto bye; + } /* Get FW from from /lib/firmware/ */ ret = request_firmware(&fw, fw_info->fw_mod_name, |