Re: [PATCH] mm/gup.c: Handling ERR within unpin_user_pages()

2020-09-14 Thread Ira Weiny
On Tue, Sep 15, 2020 at 02:22:33AM +0530, Souptick Joarder wrote: > On Mon, Sep 14, 2020 at 7:38 PM Jason Gunthorpe wrote: > > > > On Mon, Sep 14, 2020 at 07:20:34AM +0530, Souptick Joarder wrote: > > > On Sun, Sep 13, 2020 at 8:25 PM Matthew Wilcox > > > wrote: > > > > > > > > On Sun, Sep 13, 2

Re: [PATCH] mm/gup.c: Handling ERR within unpin_user_pages()

2020-09-14 Thread John Hubbard
On 9/14/20 1:52 PM, Souptick Joarder wrote: On Mon, Sep 14, 2020 at 7:38 PM Jason Gunthorpe wrote: On Mon, Sep 14, 2020 at 07:20:34AM +0530, Souptick Joarder wrote: On Sun, Sep 13, 2020 at 8:25 PM Matthew Wilcox wrote: On Sun, Sep 13, 2020 at 08:02:35PM +0530, Souptick Joarder wrote: It i

Re: [PATCH] mm/gup.c: Handling ERR within unpin_user_pages()

2020-09-14 Thread Souptick Joarder
On Mon, Sep 14, 2020 at 7:38 PM Jason Gunthorpe wrote: > > On Mon, Sep 14, 2020 at 07:20:34AM +0530, Souptick Joarder wrote: > > On Sun, Sep 13, 2020 at 8:25 PM Matthew Wilcox wrote: > > > > > > On Sun, Sep 13, 2020 at 08:02:35PM +0530, Souptick Joarder wrote: > > > > It is possible that a buggy

Re: [PATCH] mm/gup.c: Handling ERR within unpin_user_pages()

2020-09-14 Thread Jason Gunthorpe
On Mon, Sep 14, 2020 at 07:20:34AM +0530, Souptick Joarder wrote: > On Sun, Sep 13, 2020 at 8:25 PM Matthew Wilcox wrote: > > > > On Sun, Sep 13, 2020 at 08:02:35PM +0530, Souptick Joarder wrote: > > > It is possible that a buggy caller of unpin_user_pages() > > > (specially in error handling path

Re: [PATCH] mm/gup.c: Handling ERR within unpin_user_pages()

2020-09-13 Thread Souptick Joarder
On Sun, Sep 13, 2020 at 8:25 PM Matthew Wilcox wrote: > > On Sun, Sep 13, 2020 at 08:02:35PM +0530, Souptick Joarder wrote: > > It is possible that a buggy caller of unpin_user_pages() > > (specially in error handling path) may end up calling it with > > npages < 0 which is unnecessary. > > @@ -32

Re: [PATCH] mm/gup.c: Handling ERR within unpin_user_pages()

2020-09-13 Thread Matthew Wilcox
On Sun, Sep 13, 2020 at 08:02:35PM +0530, Souptick Joarder wrote: > It is possible that a buggy caller of unpin_user_pages() > (specially in error handling path) may end up calling it with > npages < 0 which is unnecessary. > @@ -328,6 +328,9 @@ void unpin_user_pages(struct page **pages, unsigned l

[PATCH] mm/gup.c: Handling ERR within unpin_user_pages()

2020-09-13 Thread Souptick Joarder
It is possible that a buggy caller of unpin_user_pages() (specially in error handling path) may end up calling it with npages < 0 which is unnecessary. This can be fixed by adding extra check inside unpin_user_pages(). Signed-off-by: Souptick Joarder Cc: John Hubbard --- mm/gup.c | 3 +++ 1 fi