Commit f1a8f40
committed
Bluetooth: L2CAP: Fix deadlock
This fixes the following deadlock introduced by 39a92a55be13
("bluetooth/l2cap: sync sock recv cb and release")
============================================
WARNING: possible recursive locking detected
6.10.0-rc3-g4029dba6b6f1 #6823 Not tainted
--------------------------------------------
kworker/u5:0/35 is trying to acquire lock:
ffff888002ec2510 (&chan->lock#2/1){+.+.}-{3:3}, at:
l2cap_sock_recv_cb+0x44/0x1e0
but task is already holding lock:
ffff888002ec2510 (&chan->lock#2/1){+.+.}-{3:3}, at:
l2cap_get_chan_by_scid+0xaf/0xd0
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----
lock(&chan->lock#2/1);
lock(&chan->lock#2/1);
*** DEADLOCK ***
May be due to missing lock nesting notation
3 locks held by kworker/u5:0/35:
#0: ffff888002b8a940 ((wq_completion)hci0#2){+.+.}-{0:0}, at:
process_one_work+0x750/0x930
#1: ffff888002c67dd0 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0},
at: process_one_work+0x44e/0x930
#2: ffff888002ec2510 (&chan->lock#2/1){+.+.}-{3:3}, at:
l2cap_get_chan_by_scid+0xaf/0xd0
To fix the original problem this introduces l2cap_chan_lock at
l2cap_conless_channel to ensure that l2cap_sock_recv_cb is called with
chan->lock held.
Fixes: 89e856e ("bluetooth/l2cap: sync sock recv cb and release")
Signed-off-by: Luiz Augusto von Dentz <[email protected]>1 parent 1cc18c2 commit f1a8f40
File tree
5 files changed
+37
-66
lines changed- include/net/bluetooth
- net/bluetooth
5 files changed
+37
-66
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | 66 | | |
111 | 67 | | |
112 | 68 | | |
| |||
735 | 691 | | |
736 | 692 | | |
737 | 693 | | |
| 694 | + | |
738 | 695 | | |
739 | 696 | | |
740 | 697 | | |
| |||
761 | 718 | | |
762 | 719 | | |
763 | 720 | | |
764 | | - | |
765 | | - | |
| 721 | + | |
| 722 | + | |
766 | 723 | | |
767 | 724 | | |
768 | 725 | | |
| |||
773 | 730 | | |
774 | 731 | | |
775 | 732 | | |
776 | | - | |
777 | | - | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
778 | 737 | | |
779 | 738 | | |
780 | 739 | | |
781 | 740 | | |
782 | | - | |
783 | | - | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
784 | 744 | | |
785 | 745 | | |
786 | 746 | | |
787 | | - | |
788 | | - | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
789 | 750 | | |
790 | 751 | | |
791 | 752 | | |
| |||
795 | 756 | | |
796 | 757 | | |
797 | 758 | | |
798 | | - | |
799 | | - | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
800 | 764 | | |
801 | 765 | | |
802 | 766 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
283 | 296 | | |
284 | 297 | | |
285 | 298 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6761 | 6761 | | |
6762 | 6762 | | |
6763 | 6763 | | |
| 6764 | + | |
| 6765 | + | |
6764 | 6766 | | |
6765 | 6767 | | |
6766 | 6768 | | |
| |||
6777 | 6779 | | |
6778 | 6780 | | |
6779 | 6781 | | |
| 6782 | + | |
6780 | 6783 | | |
6781 | 6784 | | |
6782 | 6785 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1489 | 1489 | | |
1490 | 1490 | | |
1491 | 1491 | | |
1492 | | - | |
1493 | | - | |
1494 | | - | |
1495 | | - | |
1496 | | - | |
1497 | 1492 | | |
1498 | | - | |
1499 | | - | |
1500 | | - | |
1501 | | - | |
| 1493 | + | |
1502 | 1494 | | |
1503 | | - | |
1504 | 1495 | | |
1505 | 1496 | | |
1506 | 1497 | | |
| |||
1552 | 1543 | | |
1553 | 1544 | | |
1554 | 1545 | | |
1555 | | - | |
1556 | | - | |
1557 | 1546 | | |
1558 | 1547 | | |
1559 | 1548 | | |
| |||
0 commit comments