summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalah Triki <salah.triki@gmail.com>2025-08-25 10:34:35 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-10-15 12:04:22 +0200
commit2ead548473f58c7960b6b939b79503c4a0a2c0bd (patch)
tree9138553cd6d8a22a7262b984fae405dc5ce0afa2
parentb7e0535060a60cc99eafc19cc665d979714cd73a (diff)
downloadlinux-2ead548473f58c7960b6b939b79503c4a0a2c0bd.tar.gz
linux-2ead548473f58c7960b6b939b79503c4a0a2c0bd.tar.bz2
linux-2ead548473f58c7960b6b939b79503c4a0a2c0bd.zip
bus: fsl-mc: Check return value of platform_get_resource()
commit 25f526507b8ccc6ac3a43bc094d09b1f9b0b90ae upstream. platform_get_resource() returns NULL in case of failure, so check its return value and propagate the error in order to prevent NULL pointer dereference. Fixes: 6305166c8771 ("bus: fsl-mc: Add ACPI support for fsl-mc") Cc: stable@vger.kernel.org Signed-off-by: Salah Triki <salah.triki@gmail.com> Acked-by: Ioana Ciornei <ioana.ciornei@nxp.com> Link: https://lore.kernel.org/r/aKwuK6TRr5XNYQ8u@pc Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/bus/fsl-mc/fsl-mc-bus.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
index c1c0a4759c7e..5027da143728 100644
--- a/drivers/bus/fsl-mc/fsl-mc-bus.c
+++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
@@ -1104,6 +1104,9 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
* Get physical address of MC portal for the root DPRC:
*/
plat_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!plat_res)
+ return -EINVAL;
+
mc_portal_phys_addr = plat_res->start;
mc_portal_size = resource_size(plat_res);
mc_portal_base_phys_addr = mc_portal_phys_addr & ~0x3ffffff;