From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail143.messagelabs.com (mail143.messagelabs.com [216.82.254.35]) by kanga.kvack.org (Postfix) with SMTP id F249A5F0001 for ; Tue, 14 Apr 2009 02:57:10 -0400 (EDT) Received: from m1.gw.fujitsu.co.jp ([10.0.50.71]) by fgwmail7.fujitsu.co.jp (Fujitsu Gateway) with ESMTP id n3E6w356004004 for (envelope-from kosaki.motohiro@jp.fujitsu.com); Tue, 14 Apr 2009 15:58:03 +0900 Received: from smail (m1 [127.0.0.1]) by outgoing.m1.gw.fujitsu.co.jp (Postfix) with ESMTP id EE98645DD75 for ; Tue, 14 Apr 2009 15:58:02 +0900 (JST) Received: from s1.gw.fujitsu.co.jp (s1.gw.fujitsu.co.jp [10.0.50.91]) by m1.gw.fujitsu.co.jp (Postfix) with ESMTP id C61B645DD76 for ; Tue, 14 Apr 2009 15:58:02 +0900 (JST) Received: from s1.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s1.gw.fujitsu.co.jp (Postfix) with ESMTP id CA224E08003 for ; Tue, 14 Apr 2009 15:58:02 +0900 (JST) Received: from ml14.s.css.fujitsu.com (ml14.s.css.fujitsu.com [10.249.87.104]) by s1.gw.fujitsu.co.jp (Postfix) with ESMTP id 629DCE08001 for ; Tue, 14 Apr 2009 15:58:02 +0900 (JST) From: KOSAKI Motohiro Subject: Re: [RFC][PATCH v3 6/6] fix wrong get_user_pages usage in iovlock.c In-Reply-To: <200904141656.14191.nickpiggin@yahoo.com.au> References: <20090414152151.C659.A69D9226@jp.fujitsu.com> <200904141656.14191.nickpiggin@yahoo.com.au> Message-Id: <20090414155719.C66B.A69D9226@jp.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Date: Tue, 14 Apr 2009 15:58:00 +0900 (JST) Sender: owner-linux-mm@kvack.org To: Nick Piggin Cc: kosaki.motohiro@jp.fujitsu.com, LKML , Linus Torvalds , Andrew Morton , Andrea Arcangeli , Jeff Moyer , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Maciej Sosnowski , "David S. Miller" , Chris Leech , netdev@vger.kernel.org List-ID: > 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 > > Cc: Maciej Sosnowski > > Cc: David S. Miller > > Cc: Chris Leech > > Cc: netdev@vger.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. OK. I'll fix. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org