[PATCH v2] ubi: block: fix memleak in ubiblock_create()

Dan Carpenter dan.carpenter at linaro.org
Sun Apr 14 23:33:22 PDT 2024


On Fri, Dec 08, 2023 at 03:46:29PM +0800, linan666 at huaweicloud.com wrote:
> From: Li Nan <linan122 at huawei.com>
> 
> If idr_alloc() fails, dev->gd will be put after goto out_cleanup_disk in
> ubiblock_create(), but dev->gd has not been assigned yet at this time, and
> 'gd' will not be put anymore. Fix it by putting 'gd' directly.
> 

There is another invalid reference to dev->gd if blk_mq_alloc_tag_set()
fails.

	dev_err(disk_to_dev(dev->gd), "blk_mq_alloc_tag_set failed");
                            ^^^^^^^

regards,
dan carpenter




More information about the linux-mtd mailing list