mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
mtd: virt-concat: unlink concat node before freeing it
mtd_virt_concat_create_item() links each new mtd_virt_concat_node to
concat_node_list. mtd_virt_concat_destroy() later frees the node after
destroying its concatenated MTD device, but fails to unlink it. A later
list traversal dereferences the freed node, causing a use-after-free.
Remove the node from concat_node_list before freeing it.
Fixes: 43db6366fc ("mtd: Add driver for concatenating devices")
Cc: stable@vger.kernel.org
Assisted-by: Codex:gpt-5.6, smatch
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
This commit is contained in:
parent
2e566a6830
commit
532caaa2f4
|
|
@ -130,6 +130,7 @@ int mtd_virt_concat_destroy(struct mtd_info *mtd)
|
|||
mtd_concat_destroy(&concat->mtd);
|
||||
}
|
||||
|
||||
list_del(&item->head);
|
||||
for (idx = 0; idx < item->count; idx++)
|
||||
of_node_put(item->nodes[idx]);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user