]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
dmaengine: dw-edma-pcie: Reject devices without driver data
authorKoichiro Den <den@valinux.co.jp>
Thu, 21 May 2026 14:21:51 +0000 (23:21 +0900)
committerVinod Koul <vkoul@kernel.org>
Mon, 8 Jun 2026 11:32:21 +0000 (17:02 +0530)
dw_edma_pcie_probe() treats the PCI device ID driver_data as the
template for the controller layout and copies it unconditionally. A
device bound dynamically via sysfs can match the driver without that
data, which leads to a NULL pointer dereference.

Reject such matches before enabling the device.

Fixes: 41aaff2a2ac0 ("dmaengine: Add Synopsys eDMA IP PCIe glue-logic")
Cc: stable@vger.kernel.org
Signed-off-by: Koichiro Den <den@valinux.co.jp>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260521142153.2957432-3-den@valinux.co.jp
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/dw-edma/dw-edma-pcie.c

index 2082d0021a8d91ef6baedb746ec5b32d3897cd1d..791c46e8ae4c4441e79a8bd15c128c07df0c5ad1 100644 (file)
@@ -328,6 +328,9 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev,
        int i, mask;
        bool non_ll = false;
 
+       if (!pdata)
+               return -ENODEV;
+
        struct dw_edma_pcie_data *vsec_data __free(kfree) =
                kmalloc_obj(*vsec_data);
        if (!vsec_data)