All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: hisilicon: hns: fix error return code of hns_nic_clear_all_rx_fetch()
@ 2021-03-07  8:40 Jia-Ju Bai
  2021-03-08 20:00 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2021-03-07  8:40 UTC (permalink / raw)
  To: yisen.zhuang, salil.mehta, davem, kuba, tariqt, jesse.brandeburg,
	dinghao.liu, trix, song.bao.hua, Jason, wanghai38
  Cc: netdev, linux-kernel, Jia-Ju Bai

When hns_assemble_skb() returns NULL to skb, no error return code of
hns_nic_clear_all_rx_fetch() is assigned.
To fix this bug, ret is assigned with -ENOMEM in this case.

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 drivers/net/ethernet/hisilicon/hns/hns_enet.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
index 5d7824d2b4d4..c66a7a51198e 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
@@ -1663,8 +1663,10 @@ static int hns_nic_clear_all_rx_fetch(struct net_device *ndev)
 			for (j = 0; j < fetch_num; j++) {
 				/* alloc one skb and init */
 				skb = hns_assemble_skb(ndev);
-				if (!skb)
+				if (!skb) {
+					ret = -ENOMEM;
 					goto out;
+				}
 				rd = &tx_ring_data(priv, skb->queue_mapping);
 				hns_nic_net_xmit_hw(ndev, skb, rd);
 
-- 
2.17.1


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

* Re: [PATCH] net: hisilicon: hns: fix error return code of hns_nic_clear_all_rx_fetch()
  2021-03-07  8:40 [PATCH] net: hisilicon: hns: fix error return code of hns_nic_clear_all_rx_fetch() Jia-Ju Bai
@ 2021-03-08 20:00 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-03-08 20:00 UTC (permalink / raw)
  To: Jia-Ju Bai
  Cc: yisen.zhuang, salil.mehta, davem, kuba, tariqt, jesse.brandeburg,
	dinghao.liu, trix, song.bao.hua, Jason, wanghai38, netdev,
	linux-kernel

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Sun,  7 Mar 2021 00:40:12 -0800 you wrote:
> When hns_assemble_skb() returns NULL to skb, no error return code of
> hns_nic_clear_all_rx_fetch() is assigned.
> To fix this bug, ret is assigned with -ENOMEM in this case.
> 
> Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
> 
> [...]

Here is the summary with links:
  - net: hisilicon: hns: fix error return code of hns_nic_clear_all_rx_fetch()
    https://git.kernel.org/netdev/net/c/143c253f42ba

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2021-03-08 20:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-07  8:40 [PATCH] net: hisilicon: hns: fix error return code of hns_nic_clear_all_rx_fetch() Jia-Ju Bai
2021-03-08 20:00 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.