[PATCH v3 3/3] mtd: maps: vmu-flash: fix NULL pointer dereference in initialization

Florian Fuchs fuchsfl at gmail.com
Mon May 18 04:45:21 PDT 2026


The mtd_info contains a struct device, which must be linked to its
parent. Without this, the initialization of the MTD fails with a NULL
pointer dereference.

Fixes: 47a72688fae7 ("mtd: flash mapping support for Dreamcast VMU.")
Cc: stable at vger.kernel.org
Signed-off-by: Florian Fuchs <fuchsfl at gmail.com>
---
v2->v3: no functional change, added Fixes, Cc tag according to feedback
v1->v2: no functional change

v2: https://lore.kernel.org/lkml/20260427114750.2480900-4-fuchsfl@gmail.com/
v1: https://lore.kernel.org/lkml/20251117224408.498449-4-fuchsfl@gmail.com/

 drivers/mtd/maps/vmu-flash.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mtd/maps/vmu-flash.c b/drivers/mtd/maps/vmu-flash.c
index b76d0609d1b7..10244e6731d0 100644
--- a/drivers/mtd/maps/vmu-flash.c
+++ b/drivers/mtd/maps/vmu-flash.c
@@ -547,6 +547,7 @@ static void vmu_queryblocks(struct mapleq *mq)
 	mpart->partition = card->partition;
 	mtd_cur->priv = mpart;
 	mtd_cur->owner = THIS_MODULE;
+	mtd_cur->dev.parent = &mdev->dev;
 
 	pcache = kzalloc_obj(struct vmu_cache);
 	if (!pcache)
-- 
2.43.0




More information about the linux-mtd mailing list