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: <CAMRc=MewhPi3O6qM7E699gpwcegNiAsizioDjREn7cOM1xHevA@mail.gmail.com>
Date: Mon, 14 Oct 2024 09:45:19 +0200
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Kent Gibson <warthog618@...il.com>
Cc: Linus Walleij <linus.walleij@...aro.org>, linux-gpio@...r.kernel.org, 
	linux-kernel@...r.kernel.org, 
	Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH v2 2/6] gpio: cdev: prepare gpio_desc_to_lineinfo() for
 being called from atomic

On Mon, Oct 14, 2024 at 3:58 AM Kent Gibson <warthog618@...il.com> wrote:
>
> On Thu, Oct 10, 2024 at 11:10:23AM +0200, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
> >
> > In order to prepare gpio_desc_to_lineinfo() to being called from atomic
> > context, add a new argument - bool atomic - which, if set, indicates
> > that no sleeping functions must be called (currently: only
> > pinctrl_gpio_can_use_line()).
> >
> > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
> > ---
> >       unsigned long dflags;
> >       const char *label;
> > @@ -2402,9 +2402,13 @@ static void gpio_desc_to_lineinfo(struct gpio_desc *desc,
> >           test_bit(FLAG_USED_AS_IRQ, &dflags) ||
> >           test_bit(FLAG_EXPORT, &dflags) ||
> >           test_bit(FLAG_SYSFS, &dflags) ||
> > -         !gpiochip_line_is_valid(guard.gc, info->offset) ||
> > -         !pinctrl_gpio_can_use_line(guard.gc, info->offset))
> > +         !gpiochip_line_is_valid(guard.gc, info->offset))
> >               info->flags |= GPIO_V2_LINE_FLAG_USED;
> > +
> > +     if (!atomic) {
> > +             if (!pinctrl_gpio_can_use_line(guard.gc, info->offset))
> > +                     info->flags |= GPIO_V2_LINE_FLAG_USED;
> > +     }
> >
>
> Should be else if.
>

If we're not atomic, let's call pinctrl_gpio_can_use_line() and update
the flag accordingly. If we're in atomic, just don't do it. In any
case do the rest. Looks good to me, am I missing something?

Bart

>
> >       if (test_bit(FLAG_IS_OUT, &dflags))
> >               info->flags |= GPIO_V2_LINE_FLAG_OUTPUT;
> > @@ -2502,7 +2506,7 @@ static int lineinfo_get_v1(struct gpio_chardev_data *cdev, void __user *ip,
> >                       return -EBUSY;
> >       }
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ