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: <CACRpkdZu_6=ZPrNbWVC9wBH5nZvAXcZmWjGb4FtjVZi6fAW1DA@mail.gmail.com>
Date:   Wed, 14 Sep 2022 15:43:31 +0200
From:   Linus Walleij <linus.walleij@...aro.org>
To:     Prathamesh Shete <pshete@...dia.com>
Cc:     bgolaszewski@...libre.com, linux-gpio@...r.kernel.org,
        linux-tegra@...r.kernel.org, linux-kernel@...r.kernel.org,
        jonathanh@...dia.com, thierry.reding@...il.com,
        smangipudi@...dia.com, kyarlagadda@...dia.com,
        Manish Bhardwaj <mbhardwaj@...dia.com>
Subject: Re: [PATCH] gpio: tegra186: Check GPIO pin permission before access.

On Wed, Sep 14, 2022 at 2:21 PM Prathamesh Shete <pshete@...dia.com> wrote:

> This change checks if we have the necessary permission to
> access the GPIO. For devices that have support for virtualisation
> we need to check both the TEGRA186_GPIO_VM_REG and the
> TEGRA186_GPIO_SCR_REG registers. For device that do not have
> virtualisation support for GPIOs we only need to check the
> TEGRA186_GPIO_SCR_REG register.
>
> Signed-off-by: Manish Bhardwaj <mbhardwaj@...dia.com>
> Signed-off-by: Prathamesh Shete <pshete@...dia.com>

Instead of doing this check in each and every single gpio callback,
set up the .init_valid_mask on struct gpio_chip, add a for-loop
looping over all GPIOs and fill in the .valid_mask.

This way the gpiolib core will do the check for you.

git grep init_valid_mask for a bunch of examples on how to use this.

Oh I see Thierry already said the same while I was typing :)

Yours,
Linus Walleij

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ