diff options
author | Arjan van de Ven <arjan@linux.intel.com> | 2008-09-22 18:00:10 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-10-17 17:40:57 -0400 |
commit | bb4e3b5ac81a9601775e62649038934acafa78e2 (patch) | |
tree | b90fbcb954eb71bae7f9344c9668bb9f0e5f189a /drivers/usb/mon | |
parent | 8520f38099ccfdac2147a0852f84ee7a8ee5e197 (diff) |
usbmon: fix tiny race exposed by the fastboot patches
usbmon registers the notifier chain, takes the bus lock and then goes to
scan the existing devices for hooking up.
Unfortunately, if usb_mon gets initialized while USB bus discovery is
going on, it's possible that usbmon gets a notifier on one cpu (which runs
without USB locks), and the scan is going on and also finds the new bus,
resulting in a double sysfs registration, which then produces a WARNING.
Pete Zaitcev did the bug diagnostics on this one
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Acked-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/mon')
-rw-r--r-- | drivers/usb/mon/mon_main.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/mon/mon_main.c b/drivers/usb/mon/mon_main.c index 442d8076b201..5e0ab4201c00 100644 --- a/drivers/usb/mon/mon_main.c +++ b/drivers/usb/mon/mon_main.c | |||
@@ -361,12 +361,12 @@ static int __init mon_init(void) | |||
361 | } | 361 | } |
362 | // MOD_INC_USE_COUNT(which_module?); | 362 | // MOD_INC_USE_COUNT(which_module?); |
363 | 363 | ||
364 | usb_register_notify(&mon_nb); | ||
365 | 364 | ||
366 | mutex_lock(&usb_bus_list_lock); | 365 | mutex_lock(&usb_bus_list_lock); |
367 | list_for_each_entry (ubus, &usb_bus_list, bus_list) { | 366 | list_for_each_entry (ubus, &usb_bus_list, bus_list) { |
368 | mon_bus_init(ubus); | 367 | mon_bus_init(ubus); |
369 | } | 368 | } |
369 | usb_register_notify(&mon_nb); | ||
370 | mutex_unlock(&usb_bus_list_lock); | 370 | mutex_unlock(&usb_bus_list_lock); |
371 | return 0; | 371 | return 0; |
372 | 372 | ||