]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drivers/cdrom/gdrom.c: fix device number leak
authorLibo Chen <clbchenlibo.chen@huawei.com>
Wed, 19 Jun 2013 00:05:43 +0000 (10:05 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 19 Jun 2013 07:12:51 +0000 (17:12 +1000)
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>
drivers/cdrom/gdrom.c

index 4afcb65cc62397466aee5f8272051e197a9c9fb1..5980cb9af857891491baee6026efe16cb84694de 100644 (file)
@@ -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;
 }