Commit c524f95
Bluetooth: ISO: Avoid circular locking dependency
[ Upstream commit 241f519 ]
This attempts to avoid circular locking dependency between sock_lock
and hdev_lock:
WARNING: possible circular locking dependency detected
6.0.0-rc7-03728-g18dd8ab0a783 #3 Not tainted
------------------------------------------------------
kworker/u3:2/53 is trying to acquire lock:
ffff888000254130 (sk_lock-AF_BLUETOOTH-BTPROTO_ISO){+.+.}-{0:0}, at:
iso_conn_del+0xbd/0x1d0
but task is already holding lock:
ffffffff9f39a080 (hci_cb_list_lock){+.+.}-{3:3}, at:
hci_le_cis_estabilished_evt+0x1b5/0x500
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (hci_cb_list_lock){+.+.}-{3:3}:
__mutex_lock+0x10e/0xfe0
hci_le_remote_feat_complete_evt+0x17f/0x320
hci_event_packet+0x39c/0x7d0
hci_rx_work+0x2bf/0x950
process_one_work+0x569/0x980
worker_thread+0x2a3/0x6f0
kthread+0x153/0x180
ret_from_fork+0x22/0x30
-> #1 (&hdev->lock){+.+.}-{3:3}:
__mutex_lock+0x10e/0xfe0
iso_connect_cis+0x6f/0x5a0
iso_sock_connect+0x1af/0x710
__sys_connect+0x17e/0x1b0
__x64_sys_connect+0x37/0x50
do_syscall_64+0x43/0x90
entry_SYSCALL_64_after_hwframe+0x62/0xcc
-> #0 (sk_lock-AF_BLUETOOTH-BTPROTO_ISO){+.+.}-{0:0}:
__lock_acquire+0x1b51/0x33d0
lock_acquire+0x16f/0x3b0
lock_sock_nested+0x32/0x80
iso_conn_del+0xbd/0x1d0
iso_connect_cfm+0x226/0x680
hci_le_cis_estabilished_evt+0x1ed/0x500
hci_event_packet+0x39c/0x7d0
hci_rx_work+0x2bf/0x950
process_one_work+0x569/0x980
worker_thread+0x2a3/0x6f0
kthread+0x153/0x180
ret_from_fork+0x22/0x30
other info that might help us debug this:
Chain exists of:
sk_lock-AF_BLUETOOTH-BTPROTO_ISO --> &hdev->lock --> hci_cb_list_lock
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(hci_cb_list_lock);
lock(&hdev->lock);
lock(hci_cb_list_lock);
lock(sk_lock-AF_BLUETOOTH-BTPROTO_ISO);
*** DEADLOCK ***
4 locks held by kworker/u3:2/53:
#0: ffff8880021d9130 ((wq_completion)hci0#2){+.+.}-{0:0}, at:
process_one_work+0x4ad/0x980
#1: ffff888002387de0 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0},
at: process_one_work+0x4ad/0x980
#2: ffff888001ac0070 (&hdev->lock){+.+.}-{3:3}, at:
hci_le_cis_estabilished_evt+0xc3/0x500
#3: ffffffff9f39a080 (hci_cb_list_lock){+.+.}-{3:3}, at:
hci_le_cis_estabilished_evt+0x1b5/0x500
Signed-off-by: Luiz Augusto von Dentz <[email protected]>
Stable-dep-of: 6a5ad25 ("Bluetooth: ISO: Fix possible circular locking dependency")
Signed-off-by: Sasha Levin <[email protected]>1 parent 8ac6043 commit c524f95
1 file changed
+38
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
264 | | - | |
| 264 | + | |
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
270 | | - | |
| 270 | + | |
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | | - | |
| 278 | + | |
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
285 | | - | |
| 285 | + | |
286 | 286 | | |
287 | 287 | | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
288 | 293 | | |
289 | 294 | | |
290 | 295 | | |
291 | 296 | | |
292 | 297 | | |
293 | | - | |
| 298 | + | |
294 | 299 | | |
295 | 300 | | |
296 | 301 | | |
| |||
300 | 305 | | |
301 | 306 | | |
302 | 307 | | |
303 | | - | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
304 | 313 | | |
305 | 314 | | |
306 | 315 | | |
| |||
324 | 333 | | |
325 | 334 | | |
326 | 335 | | |
327 | | - | |
| 336 | + | |
328 | 337 | | |
329 | 338 | | |
330 | 339 | | |
331 | 340 | | |
332 | 341 | | |
333 | | - | |
| 342 | + | |
334 | 343 | | |
335 | 344 | | |
336 | 345 | | |
| |||
340 | 349 | | |
341 | 350 | | |
342 | 351 | | |
343 | | - | |
| 352 | + | |
344 | 353 | | |
345 | 354 | | |
346 | 355 | | |
347 | 356 | | |
348 | 357 | | |
349 | 358 | | |
350 | 359 | | |
351 | | - | |
| 360 | + | |
352 | 361 | | |
353 | 362 | | |
354 | 363 | | |
355 | 364 | | |
356 | 365 | | |
357 | 366 | | |
358 | 367 | | |
359 | | - | |
| 368 | + | |
360 | 369 | | |
361 | 370 | | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
362 | 376 | | |
363 | 377 | | |
364 | 378 | | |
365 | 379 | | |
366 | 380 | | |
367 | | - | |
| 381 | + | |
368 | 382 | | |
369 | 383 | | |
370 | 384 | | |
| |||
377 | 391 | | |
378 | 392 | | |
379 | 393 | | |
380 | | - | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
381 | 399 | | |
382 | 400 | | |
383 | 401 | | |
| |||
831 | 849 | | |
832 | 850 | | |
833 | 851 | | |
| 852 | + | |
| 853 | + | |
834 | 854 | | |
835 | 855 | | |
836 | 856 | | |
837 | 857 | | |
838 | 858 | | |
839 | 859 | | |
840 | | - | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
841 | 863 | | |
842 | 864 | | |
843 | 865 | | |
844 | 866 | | |
845 | 867 | | |
846 | 868 | | |
847 | | - | |
848 | 869 | | |
849 | 870 | | |
850 | 871 | | |
| |||
1099 | 1120 | | |
1100 | 1121 | | |
1101 | 1122 | | |
1102 | | - | |
1103 | 1123 | | |
1104 | 1124 | | |
1105 | 1125 | | |
1106 | | - | |
1107 | | - | |
1108 | 1126 | | |
1109 | 1127 | | |
1110 | 1128 | | |
| 1129 | + | |
1111 | 1130 | | |
1112 | 1131 | | |
1113 | 1132 | | |
1114 | 1133 | | |
1115 | 1134 | | |
1116 | | - | |
1117 | | - | |
1118 | | - | |
| 1135 | + | |
1119 | 1136 | | |
1120 | 1137 | | |
1121 | 1138 | | |
1122 | | - | |
1123 | | - | |
1124 | 1139 | | |
1125 | 1140 | | |
1126 | 1141 | | |
| |||
0 commit comments