mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-04 18:19:28 +09:00
virtio-net: correctly check num_buf during err path
[ Upstream commit850e088d5b] If we successfully linearize the packet, num_buf will be set to zero which may confuse error handling path which assumes num_buf is at least 1 and this can lead the code tries to pop the descriptor of next buffer. Fixing this by checking num_buf against 1 before decreasing. Fixes:4941d472bf("virtio-net: do not reset during XDP set") Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e2d47fa107
commit
155cd57558
@@ -777,7 +777,7 @@ err_xdp:
|
||||
rcu_read_unlock();
|
||||
err_skb:
|
||||
put_page(page);
|
||||
while (--num_buf) {
|
||||
while (num_buf-- > 1) {
|
||||
buf = virtqueue_get_buf(rq->vq, &len);
|
||||
if (unlikely(!buf)) {
|
||||
pr_debug("%s: rx error: %d buffers missing\n",
|
||||
|
||||
Reference in New Issue
Block a user