* [PATCH] mci: fix NULL pointer dereference
@ 2025-04-30 12:11 Michael Tretter
2025-05-05 6:47 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Michael Tretter @ 2025-04-30 12:11 UTC (permalink / raw)
To: barebox; +Cc: Michael Tretter
Calling `devlookup -k` directly on an mmc device instead of an partition
causes a NULL pointer dereference for cdevm.
Return a NULL pointer in this case to signal the error.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
drivers/mci/mci-core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 592543faa7b8..abcda497646d 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -2536,6 +2536,9 @@ static char *mci_get_linux_mmcblkdev(struct block_device *blk,
if (mci_part->area_type != MMC_BLK_DATA_AREA_MAIN)
return NULL;
+ if (!cdevm)
+ return NULL;
+
id = of_alias_get_id(cdev_of_node(cdevm), "mmc");
if (id < 0)
return NULL;
--
2.39.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mci: fix NULL pointer dereference
2025-04-30 12:11 [PATCH] mci: fix NULL pointer dereference Michael Tretter
@ 2025-05-05 6:47 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-05-05 6:47 UTC (permalink / raw)
To: barebox, Michael Tretter
On Wed, 30 Apr 2025 14:11:12 +0200, Michael Tretter wrote:
> Calling `devlookup -k` directly on an mmc device instead of an partition
> causes a NULL pointer dereference for cdevm.
>
> Return a NULL pointer in this case to signal the error.
>
>
Applied, thanks!
[1/1] mci: fix NULL pointer dereference
https://git.pengutronix.de/cgit/barebox/commit/?id=3692a2d4e323 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-05-05 6:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-30 12:11 [PATCH] mci: fix NULL pointer dereference Michael Tretter
2025-05-05 6:47 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox