All of lore.kernel.org
 help / color / mirror / Atom feed
From: Libo Chen <clbchenlibo.chen@huawei.com>
To: <gregkh@linuxfoundation.org>, <axboe@kernel.dk>
Cc: <tj@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Li Zefan <lizefan@huawei.com>
Subject: [PATCH] cdrom: gdrom: fix device number leak
Date: Mon, 20 May 2013 09:34:26 +0800	[thread overview]
Message-ID: <51997DA2.4000302@huawei.com> (raw)
In-Reply-To: <5195CBE0.6010106@huawei.com>


"repost with Jens Axboe <axboe@kernel.dk> added"  suggest by Tejun Heo <tj@kernel.org>

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

Signed-off-by: Libo Chen <libo.chen@huawei.com>
---
 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




      parent reply	other threads:[~2013-05-20  1:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-17  6:19 [PATCH] cdrom: gdrom: fix device number leak Libo Chen
2013-05-17 16:53 ` Tejun Heo
2013-05-20  1:34 ` Libo Chen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51997DA2.4000302@huawei.com \
    --to=clbchenlibo.chen@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.