提交 94f0b955 编写于 作者: Y Yang Yingliang 提交者: Bjorn Helgaas

PCI: qcom-ep: Check platform_get_resource_byname() return value

If platform_get_resource_byname() fails, 'mmio_res' will be set to NULL
pointer, which causes a NULL pointer dereference when it is used in
qcom_pcie_perst_deassert().

Check the return value to prevent it.

Link: https://lore.kernel.org/r/20220429080740.1294797-1-yangyingliang@huawei.com
Fixes: f55fee56 ("PCI: qcom-ep: Add Qualcomm PCIe Endpoint controller driver")
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NLorenzo Pieralisi <lpieralisi@kernel.org>
Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: NAndrew Halaney <ahalaney@redhat.com>
上级 867ec26c
......@@ -474,6 +474,11 @@ 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;
}
pcie_ep->mmio = devm_pci_remap_cfg_resource(dev, pcie_ep->mmio_res);
if (IS_ERR(pcie_ep->mmio))
return PTR_ERR(pcie_ep->mmio);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册