diff options
author | Libo Chen <clbchenlibo.chen@huawei.com> | 2013-07-03 18:01:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-03 19:07:25 -0400 |
commit | 31bd8fbb41b1fdf61f80e3e506574b43fad5e478 (patch) | |
tree | 56461ec00eedf7f200e10166e59624170f476eaf /drivers/cdrom | |
parent | 4a184b4ff424e544359f081087723fc36efe603e (diff) |
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>
Diffstat (limited to 'drivers/cdrom')
-rw-r--r-- | drivers/cdrom/gdrom.c | 2 |
1 files changed, 1 insertions, 1 deletions
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: | |||
830 | del_gendisk(gd.disk); | 830 | del_gendisk(gd.disk); |
831 | probe_fail_no_disk: | 831 | probe_fail_no_disk: |
832 | kfree(gd.cd_info); | 832 | kfree(gd.cd_info); |
833 | probe_fail_no_mem: | ||
833 | unregister_blkdev(gdrom_major, GDROM_DEV_NAME); | 834 | unregister_blkdev(gdrom_major, GDROM_DEV_NAME); |
834 | gdrom_major = 0; | 835 | gdrom_major = 0; |
835 | probe_fail_no_mem: | ||
836 | pr_warning("Probe failed - error is 0x%X\n", err); | 836 | pr_warning("Probe failed - error is 0x%X\n", err); |
837 | return err; | 837 | return err; |
838 | } | 838 | } |