Skip to content

Commit 8fcf2d0

Browse files
ubi: block: Fix a possible use-after-free bug in ubiblock_create()
Smatch warns: drivers/mtd/ubi/block.c:438 ubiblock_create() warn: '&dev->list' not removed from list 'dev' is freed in 'out_free_dev:, but it is still on the list. To fix this, delete the list item before freeing. Fixes: 91cc8fb ("ubi: block: set BLK_MQ_F_BLOCKING") Signed-off-by: Harshit Mogalapalli <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
1 parent 22d74bc commit 8fcf2d0

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/mtd/ubi/block.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ int ubiblock_create(struct ubi_volume_info *vi)
429429
return 0;
430430

431431
out_remove_minor:
432+
list_del(&dev->list);
432433
idr_remove(&ubiblock_minor_idr, gd->first_minor);
433434
out_cleanup_disk:
434435
put_disk(dev->gd);

0 commit comments

Comments
 (0)