Skip to content

Commit 8c03a1c

Browse files
Zhihao Chengrichardweinberger
authored andcommitted
ubi: ubi_create_volume: Fix use-after-free when volume creation failed
There is an use-after-free problem for 'eba_tbl' in ubi_create_volume()'s error handling path: ubi_eba_replace_table(vol, eba_tbl) vol->eba_tbl = tbl out_mapping: ubi_eba_destroy_table(eba_tbl) // Free 'eba_tbl' out_unlock: put_device(&vol->dev) vol_release kfree(tbl->entries) // UAF Fix it by removing redundant 'eba_tbl' releasing. Fetch a reproducer in [Link]. Fixes: 493cfae ("mtd: utilize new cdev_device_add helper function") Link: https://bugzilla.kernel.org/show_bug.cgi?id=215965 Signed-off-by: Zhihao Cheng <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
1 parent 14072ee commit 8c03a1c

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

drivers/mtd/ubi/vmt.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,6 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
309309
ubi->volumes[vol_id] = NULL;
310310
ubi->vol_count -= 1;
311311
spin_unlock(&ubi->volumes_lock);
312-
ubi_eba_destroy_table(eba_tbl);
313312
out_acc:
314313
spin_lock(&ubi->volumes_lock);
315314
ubi->rsvd_pebs -= vol->reserved_pebs;

0 commit comments

Comments
 (0)