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=Me8J0fd066QaSmDhhc+g54A8m-dWTDmtx14HOPc+d0TYA@mail.gmail.com>
Date: Fri, 8 Mar 2024 10:32:54 +0100
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Alexander Sverdlin <alexander.sverdlin@...il.com>
Cc: linux-gpio@...r.kernel.org, 
	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] gpio: sysfs: repair export returning -EPERM on 1st attempt

On Thu, Mar 7, 2024 at 10:43 PM Alexander Sverdlin
<alexander.sverdlin@...il.com> wrote:
>
> It would make sense to return -EPERM if the bit was already set (already
> used), not if it was cleared. Before this fix pins can only be exported on
> the 2nd attempt:
>
> $ echo 522 > /sys/class/gpio/export
> sh: write error: Operation not permitted
> $ echo 522 > /sys/class/gpio/export
>
> Fixes: 35b545332b80 ("gpio: remove gpio_lock")
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@...il.com>
> ---
>  drivers/gpio/gpiolib-sysfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c
> index 67fc09a57f26..6853ecd98bcb 100644
> --- a/drivers/gpio/gpiolib-sysfs.c
> +++ b/drivers/gpio/gpiolib-sysfs.c
> @@ -593,7 +593,7 @@ int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
>         if (!guard.gc)
>                 return -ENODEV;
>
> -       if (!test_and_set_bit(FLAG_EXPORT, &desc->flags))
> +       if (test_and_set_bit(FLAG_EXPORT, &desc->flags))
>                 return -EPERM;
>
>         gdev = desc->gdev;
> --
> 2.43.2
>

That's of course correct. Applied.

Bart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ