diff mbox series

Bluetooth: fix connection setup in l2cap_connect

Message ID de9169c3e607696a9430f5beb182c914c136edcf.1717883849.git.pav@iki.fi (mailing list archive)
State Superseded
Headers show
Series Bluetooth: fix connection setup in l2cap_connect | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/SubjectPrefix success Gitlint PASS
tedd_an/BuildKernel success BuildKernel PASS
tedd_an/CheckAllWarning success CheckAllWarning PASS
tedd_an/CheckSparse success CheckSparse PASS
tedd_an/CheckSmatch fail CheckSparse: FAIL: Segmentation fault (core dumped) make[4]: *** [scripts/Makefile.build:244: net/bluetooth/hci_core.o] Error 139 make[4]: *** Deleting file 'net/bluetooth/hci_core.o' make[3]: *** [scripts/Makefile.build:485: net/bluetooth] Error 2 make[2]: *** [scripts/Makefile.build:485: net] Error 2 make[2]: *** Waiting for unfinished jobs.... Segmentation fault (core dumped) make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bcm203x.o] Error 139 make[4]: *** Deleting file 'drivers/bluetooth/bcm203x.o' make[4]: *** Waiting for unfinished jobs.... make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2 make[2]: *** [scripts/Makefile.build:485: drivers] Error 2 make[1]: *** [/github/workspace/src/src/Makefile:1919: .] Error 2 make: *** [Makefile:240: __sub-make] Error 2
tedd_an/BuildKernel32 success BuildKernel32 PASS
tedd_an/TestRunnerSetup success TestRunnerSetup PASS
tedd_an/TestRunner_l2cap-tester success TestRunner PASS
tedd_an/TestRunner_iso-tester fail TestRunner_iso-tester: Total: 122, Passed: 117 (95.9%), Failed: 1, Not Run: 4
tedd_an/TestRunner_bnep-tester success TestRunner PASS
tedd_an/TestRunner_mgmt-tester success TestRunner PASS
tedd_an/TestRunner_rfcomm-tester success TestRunner PASS
tedd_an/TestRunner_sco-tester success TestRunner PASS
tedd_an/TestRunner_ioctl-tester success TestRunner PASS
tedd_an/TestRunner_mesh-tester success TestRunner PASS
tedd_an/TestRunner_smp-tester success TestRunner PASS
tedd_an/TestRunner_userchan-tester success TestRunner PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Pauli Virtanen June 8, 2024, 9:59 p.m. UTC
The amp_id argument of l2cap_connect() was removed in
commit 84a4bb6548a2 ("Bluetooth: HCI: Remove HCI_AMP support")

It was always called with amp_id == 0, i.e. AMP_ID_BREDR == 0x00 (ie.
non-AMP controller).  In the above commit, the code path for amp_id != 0
was preserved, although it should have used the amp_id == 0 one.

Restore the previous behavior of the non-AMP code path, to fix problems
with L2CAP connections.

Fixes: 84a4bb6548a2 ("Bluetooth: HCI: Remove HCI_AMP support")
Signed-off-by: Pauli Virtanen <pav@iki.fi>
---

Notes:
    Tried proofreading the commit, and this part seemed suspicious.
    Can you try if this fixes the problem?

 net/bluetooth/l2cap_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

bluez.test.bot@gmail.com June 8, 2024, 10:31 p.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=860197

---Test result---

Test Summary:
CheckPatch                    PASS      0.67 seconds
GitLint                       PASS      0.32 seconds
SubjectPrefix                 PASS      0.12 seconds
BuildKernel                   PASS      29.74 seconds
CheckAllWarning               PASS      32.41 seconds
CheckSparse                   PASS      37.63 seconds
CheckSmatch                   FAIL      34.89 seconds
BuildKernel32                 PASS      28.75 seconds
TestRunnerSetup               PASS      521.46 seconds
TestRunner_l2cap-tester       PASS      18.29 seconds
TestRunner_iso-tester         FAIL      33.17 seconds
TestRunner_bnep-tester        PASS      4.72 seconds
TestRunner_mgmt-tester        PASS      111.25 seconds
TestRunner_rfcomm-tester      PASS      7.33 seconds
TestRunner_sco-tester         PASS      14.90 seconds
TestRunner_ioctl-tester       PASS      7.75 seconds
TestRunner_mesh-tester        PASS      5.83 seconds
TestRunner_smp-tester         PASS      6.81 seconds
TestRunner_userchan-tester    PASS      4.92 seconds
IncrementalBuild              PASS      27.66 seconds

Details
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:

Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: net/bluetooth/hci_core.o] Error 139
make[4]: *** Deleting file 'net/bluetooth/hci_core.o'
make[3]: *** [scripts/Makefile.build:485: net/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: net] Error 2
make[2]: *** Waiting for unfinished jobs....
Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bcm203x.o] Error 139
make[4]: *** Deleting file 'drivers/bluetooth/bcm203x.o'
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: drivers] Error 2
make[1]: *** [/github/workspace/src/src/Makefile:1919: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
Total: 122, Passed: 117 (95.9%), Failed: 1, Not Run: 4

Failed Test Cases
ISO Connect2 Suspend - Success                       Failed       4.232 seconds


---
Regards,
Linux Bluetooth
Timo Schröder June 9, 2024, 12:49 p.m. UTC | #2
Hi Pauli,

unfortunately it doesn't fix the issue. I'm still experiencing the
same behaviour. I attached btmon traces and bluetoothd log.

Best regards,
Timo

Am So., 9. Juni 2024 um 00:02 Uhr schrieb Pauli Virtanen <pav@iki.fi>:
>
> The amp_id argument of l2cap_connect() was removed in
> commit 84a4bb6548a2 ("Bluetooth: HCI: Remove HCI_AMP support")
>
> It was always called with amp_id == 0, i.e. AMP_ID_BREDR == 0x00 (ie.
> non-AMP controller).  In the above commit, the code path for amp_id != 0
> was preserved, although it should have used the amp_id == 0 one.
>
> Restore the previous behavior of the non-AMP code path, to fix problems
> with L2CAP connections.
>
> Fixes: 84a4bb6548a2 ("Bluetooth: HCI: Remove HCI_AMP support")
> Signed-off-by: Pauli Virtanen <pav@iki.fi>
> ---
>
> Notes:
>     Tried proofreading the commit, and this part seemed suspicious.
>     Can you try if this fixes the problem?
>
>  net/bluetooth/l2cap_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> index c49e0d4b3c0d..fc633feb12a1 100644
> --- a/net/bluetooth/l2cap_core.c
> +++ b/net/bluetooth/l2cap_core.c
> @@ -4016,8 +4016,8 @@ static void l2cap_connect(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd,
>                                 status = L2CAP_CS_NO_INFO;
>                         }
>                 } else {
> -                       l2cap_state_change(chan, BT_CONNECT2);
> -                       result = L2CAP_CR_PEND;
> +                       l2cap_state_change(chan, BT_CONFIG);
> +                       result = L2CAP_CR_SUCCESS;
>                         status = L2CAP_CS_AUTHEN_PEND;
>                 }
>         } else {
> --
> 2.45.2
>
Pauli Virtanen June 9, 2024, 3:01 p.m. UTC | #3
Hi,

su, 2024-06-09 kello 14:49 +0200, Timo Schröder kirjoitti:
> Hi Pauli,
> 
> unfortunately it doesn't fix the issue. I'm still experiencing the
> same behaviour. I attached btmon traces and bluetoothd log.

Right, sorry, I see now the patch is wrong and did it for the wrong if
branch... I'll send a v2.

	Pauli

> 
> Best regards,
> Timo
> 
> Am So., 9. Juni 2024 um 00:02 Uhr schrieb Pauli Virtanen <pav@iki.fi>:
> > 
> > The amp_id argument of l2cap_connect() was removed in
> > commit 84a4bb6548a2 ("Bluetooth: HCI: Remove HCI_AMP support")
> > 
> > It was always called with amp_id == 0, i.e. AMP_ID_BREDR == 0x00 (ie.
> > non-AMP controller).  In the above commit, the code path for amp_id != 0
> > was preserved, although it should have used the amp_id == 0 one.
> > 
> > Restore the previous behavior of the non-AMP code path, to fix problems
> > with L2CAP connections.
> > 
> > Fixes: 84a4bb6548a2 ("Bluetooth: HCI: Remove HCI_AMP support")
> > Signed-off-by: Pauli Virtanen <pav@iki.fi>
> > ---
> > 
> > Notes:
> >     Tried proofreading the commit, and this part seemed suspicious.
> >     Can you try if this fixes the problem?
> > 
> >  net/bluetooth/l2cap_core.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> > index c49e0d4b3c0d..fc633feb12a1 100644
> > --- a/net/bluetooth/l2cap_core.c
> > +++ b/net/bluetooth/l2cap_core.c
> > @@ -4016,8 +4016,8 @@ static void l2cap_connect(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd,
> >                                 status = L2CAP_CS_NO_INFO;
> >                         }
> >                 } else {
> > -                       l2cap_state_change(chan, BT_CONNECT2);
> > -                       result = L2CAP_CR_PEND;
> > +                       l2cap_state_change(chan, BT_CONFIG);
> > +                       result = L2CAP_CR_SUCCESS;
> >                         status = L2CAP_CS_AUTHEN_PEND;
> >                 }
> >         } else {
> > --
> > 2.45.2
> >
diff mbox series

Patch

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index c49e0d4b3c0d..fc633feb12a1 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -4016,8 +4016,8 @@  static void l2cap_connect(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd,
 				status = L2CAP_CS_NO_INFO;
 			}
 		} else {
-			l2cap_state_change(chan, BT_CONNECT2);
-			result = L2CAP_CR_PEND;
+			l2cap_state_change(chan, BT_CONFIG);
+			result = L2CAP_CR_SUCCESS;
 			status = L2CAP_CS_AUTHEN_PEND;
 		}
 	} else {