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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200810150326.mrfcxnilpmib7u3m@pali>
Date:   Mon, 10 Aug 2020 17:03:26 +0200
From:   Pali Rohár <pali@...nel.org>
To:     Jason Cooper <jason@...edaemon.net>,
        Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
        Rob Herring <robh@...nel.org>,
        Bjorn Helgaas <bhelgaas@...gle.com>
Cc:     linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] PCI: mvebu: Check if reset gpio is defined

On Friday 24 July 2020 15:29:30 Pali Rohár wrote:
> Reset gpio is optional and it does not have to be defined for all boards.
> 
> So in mvebu_pcie_powerdown() like in mvebu_pcie_powerup() check that reset
> gpio is defined prior usage to prevent NULL pointer dereference.
> 
> Signed-off-by: Pali Rohár <pali@...nel.org>
> ---
>  drivers/pci/controller/pci-mvebu.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c
> index 153a64676bc9..58607cbe84c8 100644
> --- a/drivers/pci/controller/pci-mvebu.c
> +++ b/drivers/pci/controller/pci-mvebu.c
> @@ -947,7 +947,8 @@ static int mvebu_pcie_powerup(struct mvebu_pcie_port *port)
>   */
>  static void mvebu_pcie_powerdown(struct mvebu_pcie_port *port)
>  {
> -	gpiod_set_value_cansleep(port->reset_gpio, 1);
> +	if (port->reset_gpio)
> +		gpiod_set_value_cansleep(port->reset_gpio, 1);

Please drop this patch. I have realized that gpiod_set_value_cansleep()
calls VALIDATE_DESC_VOID() macro which returns from current running
function if passed pointer is NULL. So this patch is not needed as
gpiod_set_value_cansleep() may be called with NULL pointer.

>  
>  	clk_disable_unprepare(port->clk);
>  }
> -- 
> 2.20.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ