mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kay Sievers <kay.sievers@vrfy.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Greg KH <greg@kroah.com>,
	Kernel development list <linux-kernel@vger.kernel.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Randy Dunlap <randy.dunlap@oracle.com>,
	Cornelia Huck <cornelia.huck@de.ibm.com>
Subject: Re: [RFC] kobject/kset/ktype documentation and example code updated
Date: Thu, 20 Dec 2007 08:27:19 +0100	[thread overview]
Message-ID: <1198135639.2662.54.camel@lov.site> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0712192237140.15674-100000@netrider.rowland.org>

On Wed, 2007-12-19 at 23:26 -0500, Alan Stern wrote:
> On Wed, 19 Dec 2007, Greg KH wrote:

> > associated with a kobject, then the parent for the kobject can be set to
> > NULL in the call to kobject_add() and then the kobject will be placed under
> > the kset itself.
> 
> "and then the kobject's parent will be set to the kset itself."
> 
> Kay, in my version of kobject_add() it says:
> 
> 	if (kobj->kset) {
> 		kobj->kset = kset_get(kobj->kset);
> 
> 		if (!parent) {
> 			parent = kobject_get(&kobj->kset->kobj);
> 			/*
> 			 * If the kset is our parent, get a second
> 			 * reference, we drop both the kset and the
> 			 * parent ref on cleanup
> 			 */
> 			kobject_get(parent);
> 		}
> 
> That last call to kobject_get(parent) doesn't make sense.  The code has
> already taken two references to the kset: one in the assignment of
> kobj->kset and the other in the assignment of parent.  The final
> kobject_get() then acquires a third reference, which will never be
> dropped.

Yeah, that's wrong, and caused by two patches trying to solve the same
problem. We had users assigning the kset before kobject_init() and users
doing that after it. We moved the kset referencing from kobiect_init to
kobject_add, which introduced the third reference, while we already
added the second one to fix the issues. We could drop one of the patches
in the series, but this is all already gone with the latest changes in
Greg's tree.

Thanks,
Kay


  reply	other threads:[~2007-12-20  7:30 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-20  0:30 Greg KH
2007-12-20  0:31 ` [RFC] sample kobject implementation code Greg KH
2007-12-20  0:31 ` [RFC] sample kset/ktype/kobject " Greg KH
2008-01-03 15:14   ` Cornelia Huck
2007-12-20  4:26 ` [RFC] kobject/kset/ktype documentation and example code updated Alan Stern
2007-12-20  7:27   ` Kay Sievers [this message]
2007-12-20 21:48   ` Greg KH
2007-12-20  6:32 ` Randy Dunlap
2007-12-20 21:27   ` Greg KH
2007-12-20 22:03     ` Robert P. J. Day
2007-12-20 22:20       ` Greg KH
2007-12-20 22:06     ` Randy Dunlap
2007-12-20 22:12       ` Greg KH
2007-12-20 22:29         ` Randy Dunlap
2007-12-20 22:42           ` Greg KH
2007-12-20 22:48             ` Randy Dunlap
2007-12-20 22:57     ` Alan Stern
2007-12-20  7:54 ` Dave Young
2007-12-20  8:02   ` Greg KH
2007-12-20  9:04 ` Jan Engelhardt
2007-12-20 21:16   ` 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=1198135639.2662.54.camel@lov.site \
    --to=kay.sievers@vrfy.org \
    --cc=corbet@lwn.net \
    --cc=cornelia.huck@de.ibm.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=randy.dunlap@oracle.com \
    --cc=stern@rowland.harvard.edu \
    /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

all inboxes | Powered by JetHome®