diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2016-08-05 11:51:30 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-08-09 09:45:59 -0400 |
commit | 07d316a22e119fa301fd7dba7f1e1adfd4f72c05 (patch) | |
tree | 12ec0c6092212430b4355d465c540039ca31e342 /drivers/usb/core/hub.c | |
parent | ca5cbc8b02f9b21cc8cd1ab36668763ec34f9ee8 (diff) |
USB: hub: change the locking in hub_activate
The locking in hub_activate() is not adequate to provide full mutual
exclusion with hub_quiesce(). The subroutine locks the hub's
usb_interface, but the callers of hub_quiesce() (such as
hub_pre_reset() and hub_event()) hold the lock to the hub's
usb_device.
This patch changes hub_activate() to make it acquire the same lock as
those other routines.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: <stable@vger.kernel.org> #4.4+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core/hub.c')
-rw-r--r-- | drivers/usb/core/hub.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index bb69d262b6f9..1d5fc32d06d0 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1052,7 +1052,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) | |||
1052 | 1052 | ||
1053 | /* Continue a partial initialization */ | 1053 | /* Continue a partial initialization */ |
1054 | if (type == HUB_INIT2 || type == HUB_INIT3) { | 1054 | if (type == HUB_INIT2 || type == HUB_INIT3) { |
1055 | device_lock(hub->intfdev); | 1055 | device_lock(&hdev->dev); |
1056 | 1056 | ||
1057 | /* Was the hub disconnected while we were waiting? */ | 1057 | /* Was the hub disconnected while we were waiting? */ |
1058 | if (hub->disconnected) | 1058 | if (hub->disconnected) |
@@ -1259,7 +1259,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) | |||
1259 | queue_delayed_work(system_power_efficient_wq, | 1259 | queue_delayed_work(system_power_efficient_wq, |
1260 | &hub->init_work, | 1260 | &hub->init_work, |
1261 | msecs_to_jiffies(delay)); | 1261 | msecs_to_jiffies(delay)); |
1262 | device_unlock(hub->intfdev); | 1262 | device_unlock(&hdev->dev); |
1263 | return; /* Continues at init3: below */ | 1263 | return; /* Continues at init3: below */ |
1264 | } else { | 1264 | } else { |
1265 | msleep(delay); | 1265 | msleep(delay); |
@@ -1282,7 +1282,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) | |||
1282 | /* Allow autosuspend if it was suppressed */ | 1282 | /* Allow autosuspend if it was suppressed */ |
1283 | disconnected: | 1283 | disconnected: |
1284 | usb_autopm_put_interface_async(to_usb_interface(hub->intfdev)); | 1284 | usb_autopm_put_interface_async(to_usb_interface(hub->intfdev)); |
1285 | device_unlock(hub->intfdev); | 1285 | device_unlock(&hdev->dev); |
1286 | } | 1286 | } |
1287 | 1287 | ||
1288 | kref_put(&hub->kref, hub_release); | 1288 | kref_put(&hub->kref, hub_release); |