Patch "PCI: endpoint: epf-mhi: Avoid NULL dereference if DT lacks 'mmio'" has been added to the 6.12-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    PCI: endpoint: epf-mhi: Avoid NULL dereference if DT lacks 'mmio'

to the 6.12-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     pci-endpoint-epf-mhi-avoid-null-dereference-if-dt-la.patch
and it can be found in the queue-6.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit c4efa066c64aabd245f479c97cf9d370c54d9662
Author: Zhongqiu Han <quic_zhonhan@xxxxxxxxxxx>
Date:   Tue Nov 5 20:07:35 2024 +0800

    PCI: endpoint: epf-mhi: Avoid NULL dereference if DT lacks 'mmio'
    
    [ Upstream commit 5089b3d874e9933d9842e90410d3af1520494757 ]
    
    If platform_get_resource_byname() fails and returns NULL because DT lacks
    an 'mmio' property for the MHI endpoint, dereferencing res->start will
    cause a NULL pointer access. Add a check to prevent it.
    
    Fixes: 1bf5f25324f7 ("PCI: endpoint: Add PCI Endpoint function driver for MHI bus")
    Link: https://lore.kernel.org/r/20241105120735.1240728-1-quic_zhonhan@xxxxxxxxxxx
    Signed-off-by: Zhongqiu Han <quic_zhonhan@xxxxxxxxxxx>
    [kwilczynski: error message update per the review feedback]
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@xxxxxxxxxx>
    [bhelgaas: commit log]
    Signed-off-by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
    Reviewed-by: Niklas Cassel <cassel@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/pci/endpoint/functions/pci-epf-mhi.c b/drivers/pci/endpoint/functions/pci-epf-mhi.c
index 7d070b1def116..54286a40bdfbf 100644
--- a/drivers/pci/endpoint/functions/pci-epf-mhi.c
+++ b/drivers/pci/endpoint/functions/pci-epf-mhi.c
@@ -867,12 +867,18 @@ static int pci_epf_mhi_bind(struct pci_epf *epf)
 {
 	struct pci_epf_mhi *epf_mhi = epf_get_drvdata(epf);
 	struct pci_epc *epc = epf->epc;
+	struct device *dev = &epf->dev;
 	struct platform_device *pdev = to_platform_device(epc->dev.parent);
 	struct resource *res;
 	int ret;
 
 	/* Get MMIO base address from Endpoint controller */
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mmio");
+	if (!res) {
+		dev_err(dev, "Failed to get \"mmio\" resource\n");
+		return -ENODEV;
+	}
+
 	epf_mhi->mmio_phys = res->start;
 	epf_mhi->mmio_size = resource_size(res);
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux