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:   Fri, 29 Apr 2022 07:36:12 -0500
From:   Andrew Halaney <ahalaney@...hat.com>
To:     Yang Yingliang <yangyingliang@...wei.com>
Cc:     linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org,
        linux-pci@...r.kernel.org, mani@...nel.org,
        lorenzo.pieralisi@....com
Subject: Re: [PATCH] PCI: qcom-ep: check return value after calling
 platform_get_resource_byname()

On Fri, Apr 29, 2022 at 04:07:40PM +0800, Yang Yingliang wrote:
> If platform_get_resource_byname() fails, 'mmio_res' will be set to null pointer,
> it will cause null-ptr-deref when it used in qcom_pcie_perst_deassert(), so we
> need check the return value.
> 
> Fixes: f55fee56a631 ("PCI: qcom-ep: Add Qualcomm PCIe Endpoint controller driver")
> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
> ---
>  drivers/pci/controller/dwc/pcie-qcom-ep.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
> index 6ce8eddf3a37..becb0c2ff870 100644
> --- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
> +++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
> @@ -416,6 +416,10 @@ static int qcom_pcie_ep_get_io_resources(struct platform_device *pdev,
>  
>  	pcie_ep->mmio_res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
>  							 "mmio");
> +	if (!pcie_ep->mmio_res) {
> +		dev_err(dev, "Failed to get mmio resource\n");
> +		return -EINVAL;
> +	}
>  
>  	syscon = of_parse_phandle(dev->of_node, "qcom,perst-regs", 0);
>  	if (!syscon) {
> -- 
> 2.25.1
> 

Reviewed-by: Andrew Halaney <ahalaney@...hat.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ