2013-05-17 06:19:32

by Libo Chen

[permalink] [raw]
Subject: [PATCH] cdrom: gdrom: fix device number leak


without this patch, gdrom_major will leak when gd.cd_info alloc faild

Signed-off-by: Libo Chen <[email protected]>
---
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 4afcb65..5980cb9 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;
}
--
1.7.1


2013-05-17 16:53:26

by Tejun Heo

[permalink] [raw]
Subject: Re: [PATCH] cdrom: gdrom: fix device number leak

On Fri, May 17, 2013 at 02:19:12PM +0800, Libo Chen wrote:
>
> without this patch, gdrom_major will leak when gd.cd_info alloc faild
>
> Signed-off-by: Libo Chen <[email protected]>

Acked-by: Tejun Heo <[email protected]>

This should be routed through the block tree. Can you please repost
with Jens Axboe <[email protected]> added?

Thanks.

--
tejun

2013-05-20 01:35:18

by Libo Chen

[permalink] [raw]
Subject: [PATCH] cdrom: gdrom: fix device number leak


"repost with Jens Axboe <[email protected]> added" suggest by Tejun Heo <[email protected]>

without this patch, gdrom_major will leak when gd.cd_info alloc faild

Signed-off-by: Libo Chen <[email protected]>
---
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 4afcb65..5980cb9 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;
}
--
1.7.1