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 <libo.chen@huawei.com> Cc: Jens Axboe <axboe@kernel.dk> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
4a184b4ff4
commit
31bd8fbb41
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user