Commit a18856a3 authored by Zhong Jinghua's avatar Zhong Jinghua Committed by Li Nan
Browse files

mtd/ubi/block: Fix null pointer dereference issue in error path

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I81XCK



----------------------------------------

When idr_alloc fails and goes the out_cleanup_disk error path, we get a
null pointer dereference problem because dev->gd has not been assigned
a value at this time.

Fix this problem by changing dev->gd to gd.

Fixes: 2bf50d42 ("UBI: block: Dynamically allocate minor numbers")
Signed-off-by: default avatarZhong Jinghua <zhongjinghua@huawei.com>
Signed-off-by: default avatarLi Nan <linan122@huawei.com>
parent 0e526263
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -462,7 +462,7 @@ int ubiblock_create(struct ubi_volume_info *vi)
out_remove_minor:
	idr_remove(&ubiblock_minor_idr, gd->first_minor);
out_cleanup_disk:
	blk_cleanup_disk(dev->gd);
	blk_cleanup_disk(gd);
out_free_tags:
	blk_mq_free_tag_set(&dev->tag_set);
out_free_dev: