summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYunjian Wang <wangyunjian@huawei.com>2020-12-26 16:10:05 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-01-12 19:47:54 +0100
commitd07b21eb60e7c77130835601e93ecbe3cbdb5342 (patch)
treea002bb3f312a493688387c29403c580891533dcd
parentd2c6c354d6cb71cf02ad8f2cdbd2edcba165dce2 (diff)
net: hns: fix return value check in __lb_other_process()
[ Upstream commit 5ede3ada3da7f050519112b81badc058190b9f9f ] The function skb_copy() could return NULL, the return value need to be checked. Fixes: b5996f11ea54 ("net: add Hisilicon Network Subsystem basic ethernet support") Signed-off-by: Yunjian Wang <wangyunjian@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/net/ethernet/hisilicon/hns/hns_ethtool.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
index a2f2db58b5ab..82f179b33a80 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
@@ -433,6 +433,10 @@ static void __lb_other_process(struct hns_nic_ring_data *ring_data,
/* for mutl buffer*/
new_skb = skb_copy(skb, GFP_ATOMIC);
dev_kfree_skb_any(skb);
+ if (!new_skb) {
+ netdev_err(ndev, "skb alloc failed\n");
+ return;
+ }
skb = new_skb;
check_ok = 0;