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  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:   Fri, 22 Mar 2019 16:26:29 +0000
From:   Steven Price <steven.price@....com>
To:     Kangjie Lu <kjlu@....edu>
Cc:     Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
        linux-pci@...r.kernel.org, Michal Simek <michal.simek@...inx.com>,
        linux-kernel@...r.kernel.org, pakki001@....edu,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH] pci: pcie-xilinx: fix a missing-check bug for
 __get_free_pages

On 14/03/2019 05:58, Kangjie Lu wrote:
> In case __get_free_pages fail, the fix returns to avoid NULL
> pointer dereference.
> 
> Signed-off-by: Kangjie Lu <kjlu@....edu>
> ---
>  drivers/pci/controller/pcie-xilinx.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/pci/controller/pcie-xilinx.c b/drivers/pci/controller/pcie-xilinx.c
> index 9bd1a35cd5d8..b7083e995c45 100644
> --- a/drivers/pci/controller/pcie-xilinx.c
> +++ b/drivers/pci/controller/pcie-xilinx.c
> @@ -341,6 +341,9 @@ static void xilinx_pcie_enable_msi(struct xilinx_pcie_port *port)
>  	phys_addr_t msg_addr;
>  
>  	port->msi_pages = __get_free_pages(GFP_KERNEL, 0);
> +	if (unlikely(!port->msi_pages))
> +		return;

Shouldn't the function return an error code for the calling function to
see? With this change the caller (xilinx_pcie_init_irq_domain) will
think that MSIs were enabled, but actually they weren't.

Steve

> +
>  	msg_addr = virt_to_phys((void *)port->msi_pages);
>  	pcie_write(port, 0x0, XILINX_PCIE_REG_MSIBASE1);
>  	pcie_write(port, msg_addr, XILINX_PCIE_REG_MSIBASE2);
> 

Powered by blists - more mailing lists