mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 02:17:36 -04:00
mtd: virt_concat: fix use-after-free in mtd_virt_concat_destroy_joins()
mtd_concat_destroy() frees item->concat so calling
mtd_virt_concat_put_mtd_devices(item->concat) leads to a use after free.
Fix this by moving mtd_virt_concat_put_mtd_devices() before
mtd_concat_destroy()
Fixes: 43db6366fc ("mtd: Add driver for concatenating devices")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
This commit is contained in:
committed by
Miquel Raynal
parent
cceca8cb77
commit
75c0c09541
@@ -75,8 +75,8 @@ void mtd_virt_concat_destroy_joins(void)
|
||||
if (item->concat) {
|
||||
mtd_device_unregister(mtd);
|
||||
kfree(mtd->name);
|
||||
mtd_concat_destroy(mtd);
|
||||
mtd_virt_concat_put_mtd_devices(item->concat);
|
||||
mtd_concat_destroy(mtd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user