Commit 8b4ad8fb authored by Peng Li's avatar Peng Li Committed by Greg Kroah-Hartman

net: hns3: free the pending skb when clean RX ring

[ Upstream commit cc5ff6e9 ]

If there is pending skb in RX flow when close the port, and the
pending buffer is not cleaned, the new packet will be added to
the pending skb when the port opens again, and the first new
packet has error data.

This patch cleans the pending skb when clean RX ring.
Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 71fb483c
......@@ -3851,6 +3851,13 @@ static int hns3_clear_rx_ring(struct hns3_enet_ring *ring)
ring_ptr_move_fw(ring, next_to_use);
}
/* Free the pending skb in rx ring */
if (ring->skb) {
dev_kfree_skb_any(ring->skb);
ring->skb = NULL;
ring->pending_buf = 0;
}
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment