public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Patrick Pannuto <ppannuto@codeaurora.org>
To: linux-kernel@vger.kernel.org
Cc: ppannuto@codeaurora.org, Greg Kroah-Hartman <gregkh@suse.de>,
	Andi Kleen <ak@linux.intel.com>,
	Stephen Hemminger <shemminger@vyatta.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	"Hans J. Koch" <hjk@linutronix.de>
Subject: [PATCH 3/6] Driver core: Fix memory leak on class_register error path
Date: Thu, 22 Jul 2010 15:09:03 -0700	[thread overview]
Message-ID: <1279836546-26913-4-git-send-email-ppannuto@codeaurora.org> (raw)
In-Reply-To: <1279836546-26913-1-git-send-email-ppannuto@codeaurora.org>

This leak is the same as the bus path; cp's kobj name
is set, but kset_register fails, free'ing cp, but not
cp->class_subsys.kobj.name

Signed-off-by: Patrick Pannuto <ppannuto@codeaurora.org>
---
 drivers/base/class.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/base/class.c b/drivers/base/class.c
index 8e231d0..045acaf 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -197,6 +197,7 @@ int __class_register(struct class *cls, struct lock_class_key *key)
 
 	error = kset_register(&cp->class_subsys);
 	if (error) {
+		kfree(cp->class_subsys.kobj.name);
 		kfree(cp);
 		return error;
 	}
-- 
1.7.2


  parent reply	other threads:[~2010-07-22 22:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-22 22:09 Possible memory leaks on driver core error paths Patrick Pannuto
2010-07-22 22:09 ` [PATCH 1/6] Driver core: Fix potential memory leak Patrick Pannuto
2010-07-22 23:39   ` Greg KH
2010-07-22 22:09 ` [PATCH 2/6] Driver core: Fix memory leak on bus_register error path Patrick Pannuto
2010-07-22 23:41   ` Greg KH
2010-07-24  1:19     ` Patrick Pannuto
2010-07-24  1:48       ` Patrick Pannuto
2010-07-27  0:00         ` Greg KH
2010-07-26 23:45       ` Greg KH
2010-07-22 22:09 ` Patrick Pannuto [this message]
2010-07-22 23:41   ` [PATCH 3/6] Driver core: Fix memory leak on class_register " Greg KH
2010-07-22 22:09 ` [PATCH 4/6] Driver core: Fix memory leak on sysdev_class_register " Patrick Pannuto
2010-07-22 23:41   ` Greg KH
2010-07-22 22:09 ` [PATCH 5/6] ocfs2: Fix memory leak on mlog_sys_init " Patrick Pannuto
2010-07-23 17:01   ` Pekka Enberg
2010-07-22 22:09 ` [PATCH 6/6] kobj: Fix memory leak on error path of kset_create_and_add Patrick Pannuto
2010-07-22 23:43   ` Greg KH

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=1279836546-26913-4-git-send-email-ppannuto@codeaurora.org \
    --to=ppannuto@codeaurora.org \
    --cc=ak@linux.intel.com \
    --cc=ebiederm@xmission.com \
    --cc=gregkh@suse.de \
    --cc=hjk@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    /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