]> git.baikalelectronics.ru Git - kernel.git/commit
USB: fix crash during hotplug of PCI USB controller card
authorAlan Stern <stern@rowland.harvard.edu>
Mon, 14 Apr 2014 17:48:47 +0000 (13:48 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Apr 2014 20:59:12 +0000 (13:59 -0700)
commitd706b2bda683a6cbd2905de0973f0c5698c291d6
treebdec07ff5673d3270b7c150e3d99cff1327a33d1
parent52d2ddfddbc6069df1571e3084a27d629f705ab9
USB: fix crash during hotplug of PCI USB controller card

The code in hcd-pci.c that matches up EHCI controllers with their
companion UHCI or OHCI controllers assumes that the private drvdata
fields don't get set too early.  However, it turns out that this field
gets set by usb_create_hcd(), before hcd-pci expects it, and this can
result in a crash when two controllers are probed in parallel (as can
happen when a new controller card is hotplugged).

The companions_rwsem lock was supposed to prevent this sort of thing,
but usb_create_hcd() is called outside the scope of the rwsem.

A simple solution is to check that the root-hub pointer has been
initialized as well as the drvdata field.  This doesn't happen until
usb_add_hcd() is called; that call and the check are both protected by
the rwsem.

This patch should be applied to stable kernels from 3.10 onward.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Stefani Seibold <stefani@seibold.net>
Tested-by: Stefani Seibold <stefani@seibold.net>
CC: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/hcd-pci.c