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]
Date:   Tue, 28 Apr 2020 18:53:19 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Bartosz Golaszewski <bgolaszewski@...libre.com>
Cc:     Linus Walleij <linus.walleij@...aro.org>,
        Bartosz Golaszewski <brgl@...ev.pl>,
        Geert Uytterhoeven <geert@...ux-m68k.org>,
        "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] gpiolib: don't call sleeping functions with a spinlock taken

On Tue, Apr 14, 2020 at 6:35 PM Bartosz Golaszewski
<bgolaszewski@...libre.com> wrote:
>
> wt., 14 kwi 2020 o 14:00 Linus Walleij <linus.walleij@...aro.org> napisaƂ(a):
> >
> > On Fri, Mar 20, 2020 at 10:31 AM Bartosz Golaszewski <brgl@...ev.pl> wrote:
> >
> > > From: Bartosz Golaszewski <bgolaszewski@...libre.com>
> > >
> > > We must not call pinctrl_gpio_can_use_line() with the gpio_lock taken
> > > as it takes a mutex internally. Let's move the call before taking the
> > > spinlock and store the return value.
> > >
> > > This isn't perfect - there's a moment between calling
> > > pinctrl_gpio_can_use_line() and taking the spinlock where the situation
> > > can change but it isn't a regression either: previously this part wasn't
> > > protected at all and it only affects the information user-space is
> > > seeing.

It seems I have no original at hand, so, commenting here.

It looks like we need a mutex less function which can be used here and
in the call you are considering racy.
Note, mutex followed by spin lock is fine, other way around is not.

So, here you should have something like

mutex_lock
ok_for_gpio = ...
spin_lock
...
spin_unlock
mutex_unlock.


-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ