Commit 0013017
Bluetooth: L2CAP: Fix deadlock
commit f1a8f40 upstream.
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 <luiz.von.dentz@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent b13982c commit 0013017
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 | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| |||
| 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 | | |
| |||
733 | 689 | | |
734 | 690 | | |
735 | 691 | | |
| 692 | + | |
736 | 693 | | |
737 | 694 | | |
738 | 695 | | |
| |||
764 | 721 | | |
765 | 722 | | |
766 | 723 | | |
767 | | - | |
768 | | - | |
| 724 | + | |
| 725 | + | |
769 | 726 | | |
770 | 727 | | |
771 | 728 | | |
| |||
776 | 733 | | |
777 | 734 | | |
778 | 735 | | |
779 | | - | |
780 | | - | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
781 | 740 | | |
782 | 741 | | |
783 | 742 | | |
784 | 743 | | |
785 | | - | |
786 | | - | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
787 | 747 | | |
788 | 748 | | |
789 | 749 | | |
790 | | - | |
791 | | - | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
792 | 753 | | |
793 | 754 | | |
794 | 755 | | |
| |||
798 | 759 | | |
799 | 760 | | |
800 | 761 | | |
801 | | - | |
802 | | - | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
803 | 767 | | |
804 | 768 | | |
805 | 769 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
282 | 295 | | |
283 | 296 | | |
284 | 297 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7798 | 7798 | | |
7799 | 7799 | | |
7800 | 7800 | | |
| 7801 | + | |
| 7802 | + | |
7801 | 7803 | | |
7802 | 7804 | | |
7803 | 7805 | | |
| |||
7814 | 7816 | | |
7815 | 7817 | | |
7816 | 7818 | | |
| 7819 | + | |
7817 | 7820 | | |
7818 | 7821 | | |
7819 | 7822 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1523 | 1523 | | |
1524 | 1524 | | |
1525 | 1525 | | |
1526 | | - | |
1527 | | - | |
1528 | | - | |
1529 | | - | |
1530 | | - | |
1531 | 1526 | | |
1532 | | - | |
1533 | | - | |
1534 | | - | |
1535 | | - | |
| 1527 | + | |
1536 | 1528 | | |
1537 | | - | |
1538 | 1529 | | |
1539 | 1530 | | |
1540 | 1531 | | |
| |||
1586 | 1577 | | |
1587 | 1578 | | |
1588 | 1579 | | |
1589 | | - | |
1590 | | - | |
1591 | 1580 | | |
1592 | 1581 | | |
1593 | 1582 | | |
| |||
0 commit comments