mirror of
https://github.com/torvalds/linux.git
synced 2026-06-11 16:13:03 +02:00
macvtap: fix recovery from gup errors
[ Upstream commit 4c7ab054ab ]
get user pages might fail partially in macvtap zero copy
mode. To recover we need to put all pages that we got,
but code used a wrong index resulting in double-free
errors.
Reported-by: Brad Hubbard <bhubbard@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-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:
parent
dabed30c3f
commit
2b01eeeaa3
|
|
@ -534,8 +534,10 @@ static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
|
|||
return -EMSGSIZE;
|
||||
num_pages = get_user_pages_fast(base, size, 0, &page[i]);
|
||||
if (num_pages != size) {
|
||||
for (i = 0; i < num_pages; i++)
|
||||
put_page(page[i]);
|
||||
int j;
|
||||
|
||||
for (j = 0; j < num_pages; j++)
|
||||
put_page(page[i + j]);
|
||||
}
|
||||
truesize = size * PAGE_SIZE;
|
||||
skb->data_len += len;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user