netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2] net: hns: fix return value check in __lb_other_process()
@ 2020-12-26  8:10 wangyunjian
  2020-12-28 22:59 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: wangyunjian @ 2020-12-26  8:10 UTC (permalink / raw)
  To: netdev
  Cc: yisen.zhuang, salil.mehta, liuyonglong, jerry.lilijun, xudingke,
	Yunjian Wang

From: Yunjian Wang <wangyunjian@huawei.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@huawei.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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net v2] net: hns: fix return value check in __lb_other_process()
  2020-12-26  8:10 [PATCH net v2] net: hns: fix return value check in __lb_other_process() wangyunjian
@ 2020-12-28 22:59 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-12-28 22:59 UTC (permalink / raw)
  To: wangyunjian
  Cc: netdev, yisen.zhuang, salil.mehta, liuyonglong, jerry.lilijun, xudingke

From: wangyunjian <wangyunjian@huawei.com>
Date: Sat, 26 Dec 2020 16:10:05 +0800

> From: Yunjian Wang <wangyunjian@huawei.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@huawei.com>

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-28 23:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-26  8:10 [PATCH net v2] net: hns: fix return value check in __lb_other_process() wangyunjian
2020-12-28 22:59 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).