lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 29 Nov 2007 17:11:35 -0500 (EST)
From:	Alan Stern <stern@...land.harvard.edu>
To:	Greg KH <greg@...ah.com>
cc:	Cornelia Huck <cornelia.huck@...ibm.com>,
	<linux-kernel@...r.kernel.org>, Kay Sievers <kay.sievers@...y.org>,
	Jonathan Corbet <corbet@....net>,
	Randy Dunlap <randy.dunlap@...cle.com>
Subject: Re: [RFC] Sample kset/ktype/kobject implementation

On Thu, 29 Nov 2007, Greg KH wrote:

> > > > kobject_put(foo) is needed since it gets you through kobject_cleanup()
> > > > where the name can be freed.
> > > 
> > > No, kobject_register() should have handled that for us, right?
> > 
> > kobject_register() doesn't do a kobject_put() if kobject_add() failed.
> 
> Crap.  If I can't get this code right in an example, the API is messed
> up.  Time to take Kay seriously and start to revamp the basic kobject
> api :)

The rule is simple enough.  After calling kobject_register() you should 
always use kobject_put() -- even if kobject_register() failed.

In fact, after calling kobject_init() you should use kobject_put().  
The first rule follows from this one, since kobject_register() calls 
kobject_init() internally.

Alan Stern


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists