From: Libo Chen Date: Wed, 3 Jul 2013 22:01:11 +0000 (-0700) Subject: drivers/cdrom/gdrom.c: fix device number leak X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=31bd8fbb41b1fdf61f80e3e506574b43fad5e478;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git drivers/cdrom/gdrom.c: fix device number leak Without this patch, gdrom_major will leak when gd.cd_info alloc fails. Signed-off-by: Libo Chen Cc: Jens Axboe Acked-by: Tejun Heo Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c index 4afcb65cc623..5980cb9af857 100644 --- a/drivers/cdrom/gdrom.c +++ b/drivers/cdrom/gdrom.c @@ -830,9 +830,9 @@ probe_fail_cdrom_register: del_gendisk(gd.disk); probe_fail_no_disk: kfree(gd.cd_info); +probe_fail_no_mem: unregister_blkdev(gdrom_major, GDROM_DEV_NAME); gdrom_major = 0; -probe_fail_no_mem: pr_warning("Probe failed - error is 0x%X\n", err); return err; }