提交 bb4e3b5a 编写于 作者: A Arjan van de Ven 提交者: Greg Kroah-Hartman

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: NArjan van de Ven <arjan@linux.intel.com>
Acked-by: NPete Zaitcev <zaitcev@redhat.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 8520f380
......@@ -361,12 +361,12 @@ static int __init mon_init(void)
}
// MOD_INC_USE_COUNT(which_module?);
usb_register_notify(&mon_nb);
mutex_lock(&usb_bus_list_lock);
list_for_each_entry (ubus, &usb_bus_list, bus_list) {
mon_bus_init(ubus);
}
usb_register_notify(&mon_nb);
mutex_unlock(&usb_bus_list_lock);
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册