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] [day] [month] [year] [list]
Message-ID: <CAMRc=Mf+xYFaznq+O=wEjb3UyanuH5b3hvOpNx9Jcx+Vm65g7A@mail.gmail.com>
Date:   Tue, 9 Jun 2020 09:58:16 +0200
From:   Bartosz Golaszewski <brgl@...ev.pl>
To:     Kent Gibson <warthog618@...il.com>
Cc:     Linus Walleij <linus.walleij@...aro.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>
Subject: Re: [PATCH v4 12/13] gpiolib: add new ioctl() for monitoring changes
 in line info

wt., 9 cze 2020 o 02:23 Kent Gibson <warthog618@...il.com> napisaƂ(a):
>
> On Tue, Dec 24, 2019 at 01:07:08PM +0100, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bgolaszewski@...libre.com>
> >
>
> [snip!]
>
> > +static int lineinfo_changed_notify(struct notifier_block *nb,
> > +                                unsigned long action, void *data)
> > +{
> > +     struct gpio_chardev_data *priv = to_gpio_chardev_data(nb);
> > +     struct gpioline_info_changed chg;
> > +     struct gpio_desc *desc = data;
> > +     int ret;
> > +
> > +     if (!test_bit(desc_to_gpio(desc), priv->watched_lines))
> > +             return NOTIFY_DONE;
> > +
> > +     memset(&chg, 0, sizeof(chg));
> > +     chg.info.line_offset = gpio_chip_hwgpio(desc);
> > +     chg.event_type = action;
> > +     chg.timestamp = ktime_get_real_ns();
> > +     gpio_desc_to_lineinfo(desc, &chg.info);
> > +
>
> Is this call legal?  It can sleep - in fact you recently changed that
> very function to move a mutex call outside of a spinlock protected section.
> Here it is being called within an RCU lock, as lineinfo_changed_notify
> is at the end of an atomic_notifier_call_chain.
>

Yeah, this is clearly wrong and lockdep would complain about invalid
wait context. I'm trying to remember why I went for an atomic notifier
chain here though... At first glance it doesn't look like the chain
could be called from atomic context anywhere.

Bart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ