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:   Thu, 15 Jun 2023 16:54:14 +0200
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     Bartosz Golaszewski <bartosz.golaszewski@...aro.org>,
        Linus Walleij <linus.walleij@...aro.org>,
        Alexander Stein <alexander.stein@...tq-group.com>,
        linux-kernel@...r.kernel.org, linux-gpio@...r.kernel.org,
        Bartosz Golaszewski <brgl@...ev.pl>,
        Andy Shevchenko <andy@...nel.org>
Subject: Re: [PATCH v3 3/5] gpio: aggregator: Prevent collisions between DT
 and user device IDs

Hi Andy,

Thanks for your patch!

On Thu, Jun 15, 2023 at 3:51 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
> In case we have a device instantiated via DT or other means than
> via new_device sysfs node, the collision with the latter is possible.
> Prevent such collisions by allocating user instantiated devices with
> higher IDs, currently set to 1024.

Can you please elaborate? How exactly is this possible?

Aggregators instantiated through sysfs are named "gpio-aggregator.<n>",
and are IDR-based.
Aggregators instantiated from DT are named "<unit-address>.<node-name>".
How can this conflict? When instantiated from ACPI?
What am I missing?

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>

> --- a/drivers/gpio/gpio-aggregator.c
> +++ b/drivers/gpio/gpio-aggregator.c
> @@ -26,6 +26,7 @@
>  #include <linux/gpio/driver.h>
>  #include <linux/gpio/machine.h>
>
> +#define AGGREGATOR_MIN_DEVID 1024
>  #define AGGREGATOR_MAX_GPIOS 512
>
>  /*
> @@ -135,7 +136,7 @@ static ssize_t new_device_store(struct device_driver *driver, const char *buf,
>         }
>
>         mutex_lock(&gpio_aggregator_lock);
> -       id = idr_alloc(&gpio_aggregator_idr, aggr, 0, 0, GFP_KERNEL);
> +       id = idr_alloc(&gpio_aggregator_idr, aggr, AGGREGATOR_MIN_DEVID, 0, GFP_KERNEL);

Iff this would solve an issue, it would be only temporarily, until someone
instantiates 1024 aggregators through some other means ;-)

>         mutex_unlock(&gpio_aggregator_lock);
>
>         if (id < 0) {

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ