mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-03 17:51:57 +09:00
virtio_net: don't leak memory or block when too many frags
We leak an skb when there are too many frags, we also stop processing the packet in the middle, the result is almost sure to be loss of networking. Reported-by: Michael Dalton <mwdalton@google.com> Acked-by: Michael Dalton <mwdalton@google.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
59d2a52eb5
commit
fcd8e31257
@@ -341,7 +341,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
|
||||
if (i >= MAX_SKB_FRAGS) {
|
||||
pr_debug("%s: packet too long\n", skb->dev->name);
|
||||
skb->dev->stats.rx_length_errors++;
|
||||
return NULL;
|
||||
goto err_frags;
|
||||
}
|
||||
page = virtqueue_get_buf(rq->vq, &len);
|
||||
if (!page) {
|
||||
@@ -362,6 +362,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
|
||||
err_skb:
|
||||
give_pages(rq, page);
|
||||
while (--num_buf) {
|
||||
err_frags:
|
||||
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