[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200904141656.14191.nickpiggin@yahoo.com.au>
Date: Tue, 14 Apr 2009 16:56:11 +1000
From: Nick Piggin <nickpiggin@...oo.com.au>
To: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
Linus Torvalds <torvalds@...l.org>,
Andrew Morton <akpm@...l.org>,
Andrea Arcangeli <aarcange@...hat.com>,
Jeff Moyer <jmoyer@...hat.com>, linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org,
Maciej Sosnowski <maciej.sosnowski@...el.com>,
"David S. Miller" <davem@...emloft.net>,
Chris Leech <christopher.leech@...el.com>,
netdev@...r.kernel.org
Subject: Re: [RFC][PATCH v3 6/6] fix wrong get_user_pages usage in iovlock.c
On Tuesday 14 April 2009 16:23:13 KOSAKI Motohiro wrote:
> I don't have NET-DMA usable device. I hope to get expert review.
>
> =========================
> Subject: [Untested][RFC][PATCH] fix wrong get_user_pages usage in iovlock.c
>
> down_read(mmap_sem)
> get_user_pages()
> up_read(mmap_sem)
>
> is fork unsafe.
> fix it.
>
> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
> Cc: Maciej Sosnowski <maciej.sosnowski@...el.com>
> Cc: David S. Miller <davem@...emloft.net>
> Cc: Chris Leech <christopher.leech@...el.com>
> Cc: netdev@...r.kernel.org
> ---
> drivers/dma/iovlock.c | 18 ++++++------------
> 1 file changed, 6 insertions(+), 12 deletions(-)
>
> Index: b/drivers/dma/iovlock.c
> ===================================================================
> --- a/drivers/dma/iovlock.c 2009-02-21 16:53:23.000000000 +0900
> +++ b/drivers/dma/iovlock.c 2009-04-13 04:46:02.000000000 +0900
> @@ -94,18 +94,10 @@ struct dma_pinned_list *dma_pin_iovec_pa
> pages += page_list->nr_pages;
>
> /* pin pages down */
> - down_read(¤t->mm->mmap_sem);
> - ret = get_user_pages(
> - current,
> - current->mm,
> - (unsigned long) iov[i].iov_base,
> - page_list->nr_pages,
> - 1, /* write */
> - 0, /* force */
> - page_list->pages,
> - NULL);
> - up_read(¤t->mm->mmap_sem);
> -
> + down_read(¤t->mm->mm_pinned_sem);
> + ret = get_user_pages_fast((unsigned long) iov[i].iov_base,
> + page_list->nr_pages, 1,
> + page_list->pages);
I would perhaps not fold gup_fast conversions into the same patch as
the fix.
--
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