public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Libo Chen <clbchenlibo.chen@huawei.com>
To: <gregkh@linuxfoundation.org>
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: Fri, 17 May 2013 14:19:12 +0800	[thread overview]
Message-ID: <5195CBE0.6010106@huawei.com> (raw)


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


             reply	other threads:[~2013-05-17  6:19 UTC|newest]

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

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=5195CBE0.6010106@huawei.com \
    --to=clbchenlibo.chen@huawei.com \
    --cc=akpm@linux-foundation.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox