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, 5 Jan 2012 15:17:31 -0800
From:	Greg KH <greg@...ah.com>
To:	Alan Stern <stern@...land.harvard.edu>
Cc:	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	Kay Sievers <kay.sievers@...y.org>,
	USB list <linux-usb@...r.kernel.org>,
	Kernel development list <linux-kernel@...r.kernel.org>
Subject: Re: Problems with get_driver() and driver_attach() (and new_id too)

On Thu, Jan 05, 2012 at 03:48:19PM -0500, Alan Stern wrote:
> On Thu, 5 Jan 2012, Dmitry Torokhov wrote:
> 
> > So I looked at the users of device_attach():
> > 
> > - we call it from generic bus code when adding a new driver so naturally
> >   driver is valid there;
> > - serio and gameport call it by hand but they ensure that the driver is
> >   valid because they protected by subsystem-private mutex;
> > - PCI, PCMCI, HID and USB new_id handling is tied to the driver itself
> >   and attributes are removed when driver is unregistered so there is no
> >   chance driver will be attached through newid after it has been
> >   unregistered;
> > - agp_amd64_init calls it once immediately after registering the driver;
> > - pci-stub driver is safe as well.
> 
> Okay, that's all good.
> 
> > That leaves only usb-serial which is problematic exactly as you
> > described below. So I think we should remove get_driver() and
> > put_driver(); document that caller if driver_attach() should ensure
> > that driver is live and let usb-serial code solve this issue as this
> > is the only code that plays games with drivers it does not own.
> 
> If Greg confirms that there's nothing with registering the usb driver 
> before the usb_serial driver, I can fix the usb-serial code easily.
> 
> Greg, do you know offhand whether this will break anything?  It really 
> seems like the right thing to do, because the usb_serial driver uses 
> the usb driver but not vice versa.

Hm, there was a reason I ordered the way I did, as I remember having to
go fix up a number of drivers that did it in the reverse order.  Give me
a day or so to dig it up and figure out what is going on here, and to
review this thread.

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