[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <15011411128281@webcorp02h.yandex-team.ru>
Date: Fri, 19 Sep 2014 16:04:41 +0400
From: Roman Gushchin <klamm@...dex-team.ru>
To: "dan.j.williams@...el.com" <dan.j.williams@...el.com>,
"vinod.koul@...el.com" <vinod.koul@...el.com>,
"dmaengine@...r.kernel.org" <dmaengine@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net_dma: fix memory leak in dma_pin_iocvec_pages
Ping?
03.09.2014, 13:38, "Roman Gushchin" <klamm@...dex-team.ru>:
> dma_pin_iovec_pages() calls get_user_pages() for each iovec. If
> get_user_pages() returns a number smaller than the requested number,
> dma_pin_iovec_pages() calls dma_unpin_iovec_pages(). It releases
> previously allocated iovecs, but pages pinned by last get_user_pages()
> call remain unreleased.
> Fix this by calling put_page() for each such page.
>
> Signed-off-by: Roman Gushchin <klamm@...dex-team.ru>
> ---
> drivers/dma/iovlock.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma/iovlock.c b/drivers/dma/iovlock.c
> index bb48a57..c393cf9 100644
> --- a/drivers/dma/iovlock.c
> +++ b/drivers/dma/iovlock.c
> @@ -107,8 +107,11 @@ struct dma_pinned_list *dma_pin_iovec_pages(struct iovec *iov, size_t len)
> NULL);
> up_read(¤t->mm->mmap_sem);
>
> - if (ret != page_list->nr_pages)
> + if (ret != page_list->nr_pages) {
> + for (i = 0; i < ret; i++)
> + put_page(page_list->pages[i]);
> goto unpin;
> + }
>
> local_list->nr_iovecs = i + 1;
> }
> --
> 1.9.3
>
> --
> 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/
--
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