Commit 98454bc
Bluetooth: 6lowpan: Don't hold spin lock over sleeping functions
disconnect_all_peers() calls sleeping function (l2cap_chan_close) under
spinlock. Holding the lock doesn't actually do any good -- we work on a
local copy of the list, and the lock doesn't protect against peer->chan
having already been freed.
Fix by taking refcounts of peer->chan instead. Clean up the code and
old comments a bit.
Take devices_lock instead of RCU, because the kfree_rcu();
l2cap_chan_put(); construct in chan_close_cb() does not guarantee
peer->chan is necessarily valid in RCU.
Also take l2cap_chan_lock() which is required for l2cap_chan_close().
Log: (bluez 6lowpan-tester Client Connect - Disable)
------
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:575
...
<TASK>
...
l2cap_send_disconn_req (net/bluetooth/l2cap_core.c:938 net/bluetooth/l2cap_core.c:1495)
...
? __pfx_l2cap_chan_close (net/bluetooth/l2cap_core.c:809)
do_enable_set (net/bluetooth/6lowpan.c:1048 net/bluetooth/6lowpan.c:1068)
------
Fixes: 9030582 ("Bluetooth: 6lowpan: Converting rwlocks to use RCU")
Signed-off-by: Pauli Virtanen <pav@iki.fi>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>1 parent e060088 commit 98454bc
1 file changed
Lines changed: 43 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
56 | 61 | | |
57 | 62 | | |
58 | 63 | | |
| |||
61 | 66 | | |
62 | 67 | | |
63 | 68 | | |
| 69 | + | |
| 70 | + | |
64 | 71 | | |
65 | 72 | | |
66 | 73 | | |
| |||
1014 | 1021 | | |
1015 | 1022 | | |
1016 | 1023 | | |
1017 | | - | |
1018 | | - | |
1019 | | - | |
1020 | | - | |
| 1024 | + | |
| 1025 | + | |
1021 | 1026 | | |
1022 | | - | |
1023 | | - | |
1024 | | - | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
1025 | 1030 | | |
1026 | 1031 | | |
1027 | 1032 | | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
1028 | 1037 | | |
1029 | | - | |
1030 | | - | |
1031 | | - | |
1032 | | - | |
1033 | | - | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
1034 | 1041 | | |
1035 | | - | |
1036 | | - | |
| 1042 | + | |
1037 | 1043 | | |
1038 | | - | |
1039 | | - | |
1040 | | - | |
| 1044 | + | |
1041 | 1045 | | |
1042 | | - | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
1043 | 1051 | | |
1044 | | - | |
1045 | | - | |
1046 | | - | |
| 1052 | + | |
| 1053 | + | |
1047 | 1054 | | |
1048 | | - | |
1049 | | - | |
1050 | | - | |
1051 | | - | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
1052 | 1070 | | |
1053 | 1071 | | |
1054 | 1072 | | |
| |||
0 commit comments