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] [day] [month] [year] [list]
Message-ID: <20110520080114.GC29843@pengutronix.de>
Date:	Fri, 20 May 2011 10:01:14 +0200
From:	Uwe Kleine-König 
	<u.kleine-koenig@...gutronix.de>
To:	Milton Miller <miltonm@....com>
Cc:	Greg Kroah-Hartman <gregkh@...e.de>, linux-kernel@...r.kernel.org
Subject: Re: [22/44] driver core: let dev_set_drvdata return int instead of
 void as it can fail

On Fri, May 20, 2011 at 02:53:30AM -0500, Milton Miller wrote:
> On Fri, 20 May 2011 about 00:10:40 -0000, Greg Kroah-Hartman wrote:
> > 
> > From: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
> > 
> > Before commit
> > 
> > 	b402843 (Driver core: move dev_get/set_drvdata to drivers/base/dd.c)
> > 
> > calling dev_set_drvdata with dev=NULL was an unchecked error. After some
> > discussion about what to return in this case removing the check (and so
> > producing a null pointer exception) seems fine.
> > 
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@...e.de>
> > 
> 
> I obviously didn't follow the discussions close enough and got
> confused[1], but I don't like the anticipated fallout of pushing this
> change though all the drivers.  Let alone see the arguments that not
> being able to free the device when it fails is no reason to fail.
> 
> So, my first question is:  When is it legal for a driver to set driver
> data before a device is registered?
A driver cannot set driver data on an unregistered device because it
doesn't get it's hands on it before. So it's only the code that
registers a device that has a chance to do so.

A while back I thought about breaking these constructs by setting
driver_data to NULL before a device is handed to a driver. Never came
around to make a patch tough.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
--
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