Re: [PATCH] mm/gup: protect unpin_user_pages() against npages==-ERRNO

2020-09-21 Thread Dan Carpenter
On Sat, Sep 19, 2020 at 09:13:17PM -0700, John Hubbard wrote: > On 9/19/20 8:03 PM, Souptick Joarder wrote: > > On Thu, Sep 17, 2020 at 1:11 PM Dan Carpenter > > wrote: > > > On Wed, Sep 16, 2020 at 11:57:06PM -0700, John Hubbard wrote: > > > > As suggested by Dan Carpenter, fortify unpin_user_pa

Re: [PATCH] mm/gup: protect unpin_user_pages() against npages==-ERRNO

2020-09-19 Thread John Hubbard
On 9/19/20 8:03 PM, Souptick Joarder wrote: On Thu, Sep 17, 2020 at 1:11 PM Dan Carpenter wrote: On Wed, Sep 16, 2020 at 11:57:06PM -0700, John Hubbard wrote: As suggested by Dan Carpenter, fortify unpin_user_pages() just a bit, against a typical caller mistake: check if the npages arg is real

Re: [PATCH] mm/gup: protect unpin_user_pages() against npages==-ERRNO

2020-09-19 Thread Souptick Joarder
On Thu, Sep 17, 2020 at 1:11 PM Dan Carpenter wrote: > > On Wed, Sep 16, 2020 at 11:57:06PM -0700, John Hubbard wrote: > > As suggested by Dan Carpenter, fortify unpin_user_pages() just a bit, > > against a typical caller mistake: check if the npages arg is really a > > -ERRNO value, which would b

Re: [PATCH] mm/gup: protect unpin_user_pages() against npages==-ERRNO

2020-09-17 Thread Dan Carpenter
On Wed, Sep 16, 2020 at 11:57:06PM -0700, John Hubbard wrote: > As suggested by Dan Carpenter, fortify unpin_user_pages() just a bit, > against a typical caller mistake: check if the npages arg is really a > -ERRNO value, which would blow up the unpinning loop: WARN and return. > > If this new WAR

[PATCH] mm/gup: protect unpin_user_pages() against npages==-ERRNO

2020-09-17 Thread John Hubbard
As suggested by Dan Carpenter, fortify unpin_user_pages() just a bit, against a typical caller mistake: check if the npages arg is really a -ERRNO value, which would blow up the unpinning loop: WARN and return. If this new WARN_ON() fires, then the system *might* be leaking pages (by leaving them