Commit 31bd8fbb authored by Libo Chen's avatar Libo Chen Committed by Linus Torvalds

drivers/cdrom/gdrom.c: fix device number leak

Without this patch, gdrom_major will leak when gd.cd_info alloc fails.
Signed-off-by: default avatarLibo Chen <libo.chen@huawei.com>
Cc: Jens Axboe <axboe@kernel.dk>
Acked-by: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 4a184b4f
...@@ -830,9 +830,9 @@ static int probe_gdrom(struct platform_device *devptr) ...@@ -830,9 +830,9 @@ static int probe_gdrom(struct platform_device *devptr)
del_gendisk(gd.disk); del_gendisk(gd.disk);
probe_fail_no_disk: probe_fail_no_disk:
kfree(gd.cd_info); kfree(gd.cd_info);
probe_fail_no_mem:
unregister_blkdev(gdrom_major, GDROM_DEV_NAME); unregister_blkdev(gdrom_major, GDROM_DEV_NAME);
gdrom_major = 0; gdrom_major = 0;
probe_fail_no_mem:
pr_warning("Probe failed - error is 0x%X\n", err); pr_warning("Probe failed - error is 0x%X\n", err);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment