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-next>] [day] [month] [year] [list]
Date:	Tue, 24 Jan 2012 13:33:37 -0500 (EST)
From:	Alan Stern <stern@...land.harvard.edu>
To:	Greg KH <greg@...ah.com>
cc:	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	Kyungmin Park <kyungmin.park@...sung.com>,
	Andy Walls <awalls@...metrocast.net>,
	Martin Schwidefsky <schwidefsky@...ibm.com>,
	Jiri Kosina <jkosina@...e.cz>,
	Jesse Barnes <jbarnes@...tuousgeek.org>,
	Dominik Brodowski <linux@...inikbrodowski.net>,
	Sebastian Ott <sebott@...ux.vnet.ibm.com>,
	"David S. Miller" <davem@...emloft.net>,
	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
	Michael Buesch <m@...s.ch>,
	Joerg Roedel <joerg.roedel@....com>,
	<linux-input@...r.kernel.org>, <linux-media@...r.kernel.org>,
	<netdev@...r.kernel.org>, <linux-pcmcia@...ts.infradead.org>,
	<linux-s390@...r.kernel.org>, USB list <linux-usb@...r.kernel.org>,
	<xen-devel@...ts.xensource.com>,
	Kernel development list <linux-kernel@...r.kernel.org>
Subject: [PATCH 0/5] Get rid of get_driver() and put_driver()

Greg:

This patch series removes the get_driver() and put_driver() routines
from the kernel.

Those routines don't do anything useful.  Their comments say that they
increment and decrement the driver's reference count, just like
get_device()/put_device() and a lot of other utility routines.  But a
struct driver is _not_ like a struct device!  It resembles a piece of
code more than a piece of data -- it acts as an encapsulation of a
driver.  Incrementing its refcount doesn't have much meaning because a
driver's lifetime isn't determined by the structure's refcount; it's
determined by when the driver's module gets unloaded.

What really matters for a driver is whether or not it is registered.  
Drivers expect, for example, that none of their methods will be called
after driver_unregister() returns.  It doesn't matter if some other
thread still holds a reference to the driver structure; that reference
mustn't be used for accessing the driver code after unregistration.  
get_driver() does not do any checking for this.

People may have been misled by the kerneldoc into thinking that the
references obtained by get_driver() do somehow pin the driver structure
in memory.  This simply isn't true; all it pins is the associated
private structure.  Code that needs to pin a driver must do it some
other way (probably by calling try_module_get()).

In short, these routines don't do anything useful and they can actively 
mislead people.  Removing them won't introduce any bugs that aren't 
already present.  There is no reason to keep them.

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

Powered by Openwall GNU/*/Linux Powered by OpenVZ