qlcnic: Add null check after calling netdev_alloc_skb
authorTom Seewald <tseewald@gmail.com>
Mon, 3 May 2021 11:56:52 +0000 (13:56 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 May 2021 09:47:01 +0000 (11:47 +0200)
commit734e2d3acd33ae12cfbc66ad3b1499cf5ecd160f
tree424e6499885274b035b2cd9b389bfba83b5951e2
parent8bffe230048f4bd55fbc6f9e741c73daf5ee8d06
qlcnic: Add null check after calling netdev_alloc_skb

commit 84460f01cba382553199bc1361f69a872d5abed4 upstream.

The function qlcnic_dl_lb_test() currently calls netdev_alloc_skb()
without checking afterwards that the allocation succeeded. Fix this by
checking if the skb is NULL and returning an error in such a case.
Breaking out of the loop if the skb is NULL is not correct as no error
would be reported to the caller and no message would be printed for the
user.

Cc: David S. Miller <davem@davemloft.net>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Tom Seewald <tseewald@gmail.com>
Link: https://lore.kernel.org/r/20210503115736.2104747-26-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c