]> git.ipfire.org Git - people/arne_f/kernel.git/commit
USB: unbind all interfaces before rebinding any
authorAlan Stern <stern@rowland.harvard.edu>
Wed, 12 Mar 2014 15:30:38 +0000 (11:30 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 6 May 2014 14:51:45 +0000 (07:51 -0700)
commitd6f6fc7a2bc99124058b7c4850a9997530589a33
tree9bc2384599e2b0be35cf36266c24c8f12dfb735c
parent216583b5033215cd64468b865c0ee96d265cf546
USB: unbind all interfaces before rebinding any

commit 6aec044cc2f5670cf3b143c151c8be846499bd15 upstream.

When a driver doesn't have pre_reset, post_reset, or reset_resume
methods, the USB core unbinds that driver when its device undergoes a
reset or a reset-resume, and then rebinds it afterward.

The existing straightforward implementation can lead to problems,
because each interface gets unbound and rebound before the next
interface is handled.  If a driver claims additional interfaces, the
claim may fail because the old binding instance may still own the
additional interface when the new instance tries to claim it.

This patch fixes the problem by first unbinding all the interfaces
that are marked (i.e., their needs_binding flag is set) and then
rebinding all of them.

The patch also makes the helper functions in driver.c a little more
uniform and adjusts some out-of-date comments.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-and-tested-by: "Poulain, Loic" <loic.poulain@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/driver.c
drivers/usb/core/hub.c
drivers/usb/core/usb.h