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:	Tue, 1 Aug 2006 21:13:05 -0400
From:	Dmitry Torokhov <dtor@...ightbb.com>
To:	Pete Zaitcev <zaitcev@...hat.com>
Cc:	greg@...ah.com, linux-kernel@...r.kernel.org
Subject: Re: get_device in device_create_file

On Tuesday 01 August 2006 16:25, Pete Zaitcev wrote:
> Hi, Greg:
> 
> This code makes no sense to me:
> 
> > int device_create_file(struct device * dev, struct device_attribute * attr)
> > {
> > 	int error = 0;
> > 	if (get_device(dev)) {
> > 		error = sysfs_create_file(&dev->kobj, &attr->attr);
> > 		put_device(dev);
> > 	}
> > 	return error;
> > }
> 
> If the struct device *dev, and its presumably enclosing structure,
> can be freed by a different CPU (or pre-empt), then get_device
> does not protect it. It can be freed before get_device is reached.

*nod*

> Buf it not, and the caller has a reference, then the call to
> get_device is redundant.
>

Yes it is. There are few of redundant gets and puts sprinkled around
in the driver core, but the last time I mentioned that Greg was not
quite ready to get rid of them ;)
 

-- 
Dmitry
-
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