[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51C7BBA3.1050300@redhat.com>
Date: Mon, 24 Jun 2013 11:23:15 +0800
From: Jason Wang <jasowang@...hat.com>
To: "Michael S. Tsirkin" <mst@...hat.com>
CC: linux-kernel@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
netdev@...r.kernel.org, Brad Hubbard <bhubbard@...hat.com>
Subject: Re: [PATCH net] macvtap: fix recovery from gup errors
On 06/23/2013 10:26 PM, Michael S. Tsirkin wrote:
> 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@...hat.com>
> Signed-off-by: Michael S. Tsirkin <mst@...hat.com>
> ---
>
> Same as the tun patch really. Also stable material.
Acked-by: Jason Wang <jasowang@...hat.com>
>
> drivers/net/macvtap.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
> index 59e9605..4ddd108 100644
> --- a/drivers/net/macvtap.c
> +++ b/drivers/net/macvtap.c
> @@ -524,8 +524,9 @@ 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]);
> return -EFAULT;
> }
> truesize = size * PAGE_SIZE;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists