]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mtd: maps: vmu-flash: fix NULL pointer dereference in initialization
authorFlorian Fuchs <fuchsfl@gmail.com>
Mon, 18 May 2026 11:45:21 +0000 (13:45 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Wed, 27 May 2026 09:08:00 +0000 (11:08 +0200)
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@vger.kernel.org
Signed-off-by: Florian Fuchs <fuchsfl@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/maps/vmu-flash.c

index b76d0609d1b76b036dc77ca763b11cc18b8e3bf1..10244e6731d077586d2a7b55a95f8123c45362f0 100644 (file)
@@ -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)