mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-02 08:34:20 +08:00
net: hisilicon: hns: fix error return code of hns_nic_clear_all_rx_fetch()
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> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
4d8c79b7e9
commit
143c253f42
@ -1663,8 +1663,10 @@ static int hns_nic_clear_all_rx_fetch(struct net_device *ndev)
|
|||||||
for (j = 0; j < fetch_num; j++) {
|
for (j = 0; j < fetch_num; j++) {
|
||||||
/* alloc one skb and init */
|
/* alloc one skb and init */
|
||||||
skb = hns_assemble_skb(ndev);
|
skb = hns_assemble_skb(ndev);
|
||||||
if (!skb)
|
if (!skb) {
|
||||||
|
ret = -ENOMEM;
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
rd = &tx_ring_data(priv, skb->queue_mapping);
|
rd = &tx_ring_data(priv, skb->queue_mapping);
|
||||||
hns_nic_net_xmit_hw(ndev, skb, rd);
|
hns_nic_net_xmit_hw(ndev, skb, rd);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user