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>
Thu, 13 May 2021 15:33:28 +0000 (17:33 +0200)
commit84460f01cba382553199bc1361f69a872d5abed4
tree6e8918eff8182324383f27641c77b4f7f651eeb6
parentb95b57dfe7a142bf2446548eb7f49340fd73e78b
qlcnic: Add null check after calling netdev_alloc_skb

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