summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorAditya Pakki <pakki001@umn.edu>2019-03-14 15:31:40 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-16 09:17:15 +0200
commit65e6cca34beb912d33bac82dffe8848ad1cc3cf0 (patch)
treee5e9f7295edee06c8686c11cb95c17175e5f4180 /drivers/net
parenta0118894ef08a84a3bae73639878c610bec80330 (diff)
downloadlinux-stable-65e6cca34beb912d33bac82dffe8848ad1cc3cf0.tar.gz
linux-stable-65e6cca34beb912d33bac82dffe8848ad1cc3cf0.tar.bz2
linux-stable-65e6cca34beb912d33bac82dffe8848ad1cc3cf0.zip
qlcnic: Avoid potential NULL pointer dereference
[ Upstream commit 5bf7295fe34a5251b1d241b9736af4697b590670 ] netdev_alloc_skb can fail and return a NULL pointer which is dereferenced without a check. The patch avoids such a scenario. Signed-off-by: Aditya Pakki <pakki001@umn.edu> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin (Microsoft) <sashal@kernel.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
index 0a2318cad34d..63ebc491057b 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
@@ -1038,6 +1038,8 @@ int qlcnic_do_lb_test(struct qlcnic_adapter *adapter, u8 mode)
for (i = 0; i < QLCNIC_NUM_ILB_PKT; i++) {
skb = netdev_alloc_skb(adapter->netdev, QLCNIC_ILB_PKT_SIZE);
+ if (!skb)
+ break;
qlcnic_create_loopback_buff(skb->data, adapter->mac_addr);
skb_put(skb, QLCNIC_ILB_PKT_SIZE);
adapter->ahw->diag_cnt = 0;