lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFqt6zYru2VfaBFHEB6+7vMPXUbgX8R5f+GHqxaGjhP8QZEyzw@mail.gmail.com>
Date:   Mon, 14 Sep 2020 07:20:34 +0530
From:   Souptick Joarder <jrdr.linux@...il.com>
To:     Matthew Wilcox <willy@...radead.org>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Linux-MM <linux-mm@...ck.org>, linux-kernel@...r.kernel.org,
        John Hubbard <jhubbard@...dia.com>
Subject: Re: [PATCH] mm/gup.c: Handling ERR within unpin_user_pages()

On Sun, Sep 13, 2020 at 8:25 PM Matthew Wilcox <willy@...radead.org> 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.
> > @@ -328,6 +328,9 @@ void unpin_user_pages(struct page **pages, unsigned long npages)
> >  {
> >       unsigned long index;
> >
> > +     if (WARN_ON_ONCE(npages < 0))
> > +             return;
>
> But npages is unsigned long.  So it can't be less than zero.

Sorry, I missed it.

Then, it means if npages is assigned with -ERRNO by caller, unpin_user_pages()
may end up calling a big loop, which is unnecessary.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ