Skip to content

Commit 07d316a

Browse files
AlanSterngregkh
authored andcommitted
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 <[email protected]> CC: <[email protected]> #4.4+ Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent ca5cbc8 commit 07d316a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/usb/core/hub.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
10521052

10531053
/* Continue a partial initialization */
10541054
if (type == HUB_INIT2 || type == HUB_INIT3) {
1055-
device_lock(hub->intfdev);
1055+
device_lock(&hdev->dev);
10561056

10571057
/* Was the hub disconnected while we were waiting? */
10581058
if (hub->disconnected)
@@ -1259,7 +1259,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
12591259
queue_delayed_work(system_power_efficient_wq,
12601260
&hub->init_work,
12611261
msecs_to_jiffies(delay));
1262-
device_unlock(hub->intfdev);
1262+
device_unlock(&hdev->dev);
12631263
return; /* Continues at init3: below */
12641264
} else {
12651265
msleep(delay);
@@ -1282,7 +1282,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
12821282
/* Allow autosuspend if it was suppressed */
12831283
disconnected:
12841284
usb_autopm_put_interface_async(to_usb_interface(hub->intfdev));
1285-
device_unlock(hub->intfdev);
1285+
device_unlock(&hdev->dev);
12861286
}
12871287

12881288
kref_put(&hub->kref, hub_release);

0 commit comments

Comments
 (0)