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, 11 Nov 2010 06:16:11 -0800
From:	Greg KH <greg@...ah.com>
To:	Boaz Harrosh <bharrosh@...asas.com>
Cc:	Vladislav Bolkhovitin <vst@...b.net>, linux-scsi@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	scst-devel <scst-devel@...ts.sourceforge.net>,
	James Bottomley <James.Bottomley@...senPartnership.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>,
	Mike Christie <michaelc@...wisc.edu>,
	Vu Pham <vuhuong@...lanox.com>,
	Bart Van Assche <bart.vanassche@...il.com>,
	James Smart <James.Smart@...lex.Com>,
	Joe Eykholt <jeykholt@...co.com>, Andy Yan <ayan@...vell.com>,
	Chetan Loke <generationgnu@...oo.com>,
	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	Hannes Reinecke <hare@...e.de>,
	Richard Sharpe <realrichardsharpe@...il.com>,
	Daniel Henrique Debonzi <debonzi@...ux.vnet.ibm.com>
Subject: Re: [PATCH 8/19]: SCST SYSFS interface implementation

On Thu, Nov 11, 2010 at 04:05:43PM +0200, Boaz Harrosh wrote:
> On 11/11/2010 02:04 PM, Greg KH wrote:
> > On Thu, Nov 11, 2010 at 11:59:28AM +0200, Boaz Harrosh wrote:
> >> 4. Exactly Like 3 but without the extra kref member
> >>    Only x_put() changes and x_kref_release() now receives
> >>    an x_object
> >>
> >> int x_put(struct object_x *x)
> >> {
> >> 	if (kobject_put(&x->kobj) == 1)
> >> 		// Like above [3] x_kref_release()
> >> 		x_kref_release(x);
> >> }
> > 
> > This is racy, please never do this.
> > 
> 
> The last ref belongs to the core code. 1 means there are no
> more external clients on the object. So it can not race with
> decrements. But I guess there is a possibility that it can
> race with new increments.

Exactly.

> If it is the case that new increments
> can only come from, say, sysfs access, then if we call the
> x_put() == 1 after we are unregistered from sysfs and no new
> users are allowed then the counter can only go down and we
> have the last reference. No?

Just don't do this, it's not worth it and will break over time when
others mess with the code.

Also note that kobject_put() does not even return a value, so the code
above will not even compile, let alone work.

thanks,

greg k-h
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ