public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
To: Greg KH <gregkh@suse.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] Fix possible kobject reference counter leak in kobject_rename()
Date: Thu, 21 Aug 2008 19:31:48 +0900	[thread overview]
Message-ID: <48AD4414.6080604@jp.fujitsu.com> (raw)

Hi,

I found a possible kobject reference counter leak problem in
kobject_rename(). The following patch will fix it.

Thanks,
Kenji Kaneshige


Fix possible kobject reference counter leak in kobject_rename().

If kobject_rename() failed because of name collision, we must call
kobject_put() for specified kobject before return.

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>

---
 lib/kobject.c |    1 +
 1 file changed, 1 insertion(+)

Index: linux-2.6.27-rc4/lib/kobject.c
===================================================================
--- linux-2.6.27-rc4.orig/lib/kobject.c
+++ linux-2.6.27-rc4/lib/kobject.c
@@ -411,6 +411,7 @@ int kobject_rename(struct kobject *kobj,
 			       "to '%s' as '%s' is already in existence.\n",
 			       kobject_name(kobj), new_name, new_name);
 			kobject_put(temp_kobj);
+			kobject_put(kobj);
 			return -EINVAL;
 		}
 	}


             reply	other threads:[~2008-08-21 10:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-21 10:31 Kenji Kaneshige [this message]
2008-08-21 15:58 ` [PATCH] Fix possible kobject reference counter leak in kobject_rename() Greg KH
2008-08-22  2:31   ` Kenji Kaneshige

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=48AD4414.6080604@jp.fujitsu.com \
    --to=kaneshige.kenji@jp.fujitsu.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.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