[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1608970205-24512-1-git-send-email-wangyunjian@huawei.com>
Date: Sat, 26 Dec 2020 16:10:05 +0800
From: wangyunjian <wangyunjian@...wei.com>
To: <netdev@...r.kernel.org>
CC: <yisen.zhuang@...wei.com>, <salil.mehta@...wei.com>,
<liuyonglong@...wei.com>, <jerry.lilijun@...wei.com>,
<xudingke@...wei.com>, Yunjian Wang <wangyunjian@...wei.com>
Subject: [PATCH net v2] net: hns: fix return value check in __lb_other_process()
From: Yunjian Wang <wangyunjian@...wei.com>
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@...wei.com>
---
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
index 7165da0ee9aa..a6e3f07caf99 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
@@ -415,6 +415,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;
--
2.23.0
Powered by blists - more mailing lists