• Jiri Slaby's avatar
    Bluetooth: fix power_on vs close race · bf389cab
    Jiri Slaby authored
    With all the latest fixes applied, I am still able to reproduce this
    (and other) warning(s):
    WARNING: CPU: 1 PID: 19684 at ../kernel/workqueue.c:4092 destroy_workqueue+0x70a/0x770()
    ...
    Call Trace:
     [<ffffffff819fee81>] ? dump_stack+0xb3/0x112
     [<ffffffff8117377e>] ? warn_slowpath_common+0xde/0x140
     [<ffffffff811ce68a>] ? destroy_workqueue+0x70a/0x770
     [<ffffffff811739ae>] ? warn_slowpath_null+0x2e/0x40
     [<ffffffff811ce68a>] ? destroy_workqueue+0x70a/0x770
     [<ffffffffa0c944c9>] ? hci_unregister_dev+0x2a9/0x720 [bluetooth]
     [<ffffffffa0b301db>] ? vhci_release+0x7b/0xf0 [hci_vhci]
     [<ffffffffa0b30160>] ? vhci_flush+0x50/0x50 [hci_vhci]
     [<ffffffff8117cd73>] ? do_exit+0x863/0x2b90
    
    This is due to race present in the hci_unregister_dev path.
    hdev->power_on work races with hci_dev_do_close. One tries to open,
    the other tries to close, leading to warning like the above. (Another
    example is a warning in kobject_get or kobject_put depending on who
    wins the race.)
    
    Fix this by switching those two racers to ensure hdev->power_on never
    triggers while hci_dev_do_close is in progress.
    Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
    Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
    bf389cab
Name
Last commit
Last update
..
bnep Loading commit data...
cmtp Loading commit data...
hidp Loading commit data...
rfcomm Loading commit data...
6lowpan.c Loading commit data...
Kconfig Loading commit data...
Makefile Loading commit data...
a2mp.c Loading commit data...
a2mp.h Loading commit data...
af_bluetooth.c Loading commit data...
amp.c Loading commit data...
amp.h Loading commit data...
ecc.c Loading commit data...
ecc.h Loading commit data...
hci_conn.c Loading commit data...
hci_core.c Loading commit data...
hci_debugfs.c Loading commit data...
hci_debugfs.h Loading commit data...
hci_event.c Loading commit data...
hci_request.c Loading commit data...
hci_request.h Loading commit data...
hci_sock.c Loading commit data...
hci_sysfs.c Loading commit data...
l2cap_core.c Loading commit data...
l2cap_sock.c Loading commit data...
leds.c Loading commit data...
leds.h Loading commit data...
lib.c Loading commit data...
mgmt.c Loading commit data...
mgmt_util.c Loading commit data...
mgmt_util.h Loading commit data...
sco.c Loading commit data...
selftest.c Loading commit data...
selftest.h Loading commit data...
smp.c Loading commit data...
smp.h Loading commit data...