[PATCH linux-next] ubi: block: Fix a possible use-after-free bug in ubiblock_create()

Christoph Hellwig hch at lst.de
Tue Feb 14 06:10:47 PST 2023

On Tue, Feb 14, 2023 at 01:38:01AM -0800, Harshit Mogalapalli wrote:
> 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: 91cc8fbcc8c7 ("ubi: block: set BLK_MQ_F_BLOCKING")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli at oracle.com>

Thanks, this looks good:

Reviewed-by: Christoph Hellwig <hch at lst.de>

More information about the linux-mtd mailing list