Message ID | 20240411151929.403263-1-kovalev@altlinux.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [net] Bluetooth: hci_event: fix possible multiple drops by marked conn->state after hci_disconnect() | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | success | Success |
tedd_an/CheckPatch | success | CheckPatch PASS |
tedd_an/GitLint | fail | WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search 1: T1 Title exceeds max length (100>80): "[net] Bluetooth: hci_event: fix possible multiple drops by marked conn->state after hci_disconnect()" 13: B3 Line contains hard tab characters (\t): " // conn->state == BT_CONNECTED" 14: B3 Line contains hard tab characters (\t): " hci_disconnect(){" 15: B3 Line contains hard tab characters (\t): " hci_abort_conn();" 16: B3 Line contains hard tab characters (\t): " }" 17: B3 Line contains hard tab characters (\t): " hci_conn_drop();" 18: B3 Line contains hard tab characters (\t): " // conn->state == BT_CONNECTED" |
tedd_an/SubjectPrefix | success | Gitlint PASS |
tedd_an/BuildKernel | success | BuildKernel PASS |
tedd_an/CheckAllWarning | success | CheckAllWarning PASS |
tedd_an/CheckSparse | warning | CheckSparse WARNING net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h): |
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.... Segmentation fault (core dumped) make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bpa10x.o] Error 139 make[4]: *** Deleting file 'drivers/bluetooth/bpa10x.o' 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: 121 (99.2%), Failed: 1, Not Run: 0 |
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 | fail | TestRunner_mesh-tester: Total: 10, Passed: 9 (90.0%), Failed: 1, Not Run: 0 |
tedd_an/TestRunner_smp-tester | success | TestRunner PASS |
tedd_an/TestRunner_userchan-tester | success | TestRunner PASS |
tedd_an/IncrementalBuild | success | Incremental Build PASS |
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=843667 ---Test result--- Test Summary: CheckPatch PASS 0.46 seconds GitLint FAIL 0.48 seconds SubjectPrefix PASS 0.06 seconds BuildKernel PASS 29.79 seconds CheckAllWarning PASS 32.96 seconds CheckSparse WARNING 38.28 seconds CheckSmatch FAIL 36.34 seconds BuildKernel32 PASS 28.93 seconds TestRunnerSetup PASS 521.35 seconds TestRunner_l2cap-tester PASS 18.31 seconds TestRunner_iso-tester FAIL 31.19 seconds TestRunner_bnep-tester PASS 4.63 seconds TestRunner_mgmt-tester PASS 109.11 seconds TestRunner_rfcomm-tester PASS 7.20 seconds TestRunner_sco-tester PASS 14.96 seconds TestRunner_ioctl-tester PASS 7.62 seconds TestRunner_mesh-tester FAIL 6.01 seconds TestRunner_smp-tester PASS 6.80 seconds TestRunner_userchan-tester PASS 4.87 seconds IncrementalBuild PASS 27.76 seconds Details ############################## Test: GitLint - FAIL Desc: Run gitlint Output: [net] Bluetooth: hci_event: fix possible multiple drops by marked conn->state after hci_disconnect() WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search 1: T1 Title exceeds max length (100>80): "[net] Bluetooth: hci_event: fix possible multiple drops by marked conn->state after hci_disconnect()" 13: B3 Line contains hard tab characters (\t): " // conn->state == BT_CONNECTED" 14: B3 Line contains hard tab characters (\t): " hci_disconnect(){" 15: B3 Line contains hard tab characters (\t): " hci_abort_conn();" 16: B3 Line contains hard tab characters (\t): " }" 17: B3 Line contains hard tab characters (\t): " hci_conn_drop();" 18: B3 Line contains hard tab characters (\t): " // conn->state == BT_CONNECTED" ############################## Test: CheckSparse - WARNING Desc: Run sparse tool with linux kernel Output: net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h): ############################## 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.... Segmentation fault (core dumped) make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bpa10x.o] Error 139 make[4]: *** Deleting file 'drivers/bluetooth/bpa10x.o' 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: 121 (99.2%), Failed: 1, Not Run: 0 Failed Test Cases ISO Connect2 Suspend - Success Failed 4.236 seconds ############################## Test: TestRunner_mesh-tester - FAIL Desc: Run mesh-tester with test-runner Output: Total: 10, Passed: 9 (90.0%), Failed: 1, Not Run: 0 Failed Test Cases Mesh - Send cancel - 2 Failed 0.091 seconds --- Regards, Linux Bluetooth
11.04.2024 18:19, kovalev@altlinux.org wrote: > From: Vasiliy Kovalev <kovalev@altlinux.org> > > When returning from the hci_disconnect() function, the conn->state > continues to be set to BT_CONNECTED and hci_conn_drop() is executed, > which decrements the conn->refcnt. Syzkaller C reproducer: https://lore.kernel.org/all/f8bb62a7-5845-53ed-7fbe-c0557c2745f2@basealt.ru/#t During debugging, the value conn->refcnt goes down to -1000 and less. > Syzkaller has generated a reproducer that results in multiple calls to > hci_encrypt_change_evt() of the same conn object. > -- > hci_encrypt_change_evt(){ > // conn->state == BT_CONNECTED > hci_disconnect(){ > hci_abort_conn(); > } > hci_conn_drop(); > // conn->state == BT_CONNECTED > } > -- > This behavior can cause the conn->refcnt to go far into negative values > and cause problems. To get around this, you need to change the conn->state, > namely to BT_DISCONN, as it was before. > Fixes: a13f316e90fd ("Bluetooth: hci_conn: Consolidate code for aborting connections") > Cc: stable@vger.kernel.org > Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org> > --- > net/bluetooth/hci_event.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c > index 64477e1bde7cec..e0477021183f9b 100644 > --- a/net/bluetooth/hci_event.c > +++ b/net/bluetooth/hci_event.c > @@ -2989,6 +2989,7 @@ static void hci_cs_le_start_enc(struct hci_dev *hdev, u8 status) > > hci_disconnect(conn, HCI_ERROR_AUTH_FAILURE); > hci_conn_drop(conn); > + conn->state = BT_DISCONN; > > unlock: > hci_dev_unlock(hdev); > @@ -3654,6 +3655,7 @@ static void hci_encrypt_change_evt(struct hci_dev *hdev, void *data, > hci_encrypt_cfm(conn, ev->status); > hci_disconnect(conn, HCI_ERROR_AUTH_FAILURE); > hci_conn_drop(conn); > + conn->state = BT_DISCONN; > goto unlock; > } > > @@ -5248,6 +5250,7 @@ static void hci_key_refresh_complete_evt(struct hci_dev *hdev, void *data, > if (ev->status && conn->state == BT_CONNECTED) { > hci_disconnect(conn, HCI_ERROR_AUTH_FAILURE); > hci_conn_drop(conn); > + conn->state = BT_DISCONN; > goto unlock; > } >
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 64477e1bde7cec..e0477021183f9b 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -2989,6 +2989,7 @@ static void hci_cs_le_start_enc(struct hci_dev *hdev, u8 status) hci_disconnect(conn, HCI_ERROR_AUTH_FAILURE); hci_conn_drop(conn); + conn->state = BT_DISCONN; unlock: hci_dev_unlock(hdev); @@ -3654,6 +3655,7 @@ static void hci_encrypt_change_evt(struct hci_dev *hdev, void *data, hci_encrypt_cfm(conn, ev->status); hci_disconnect(conn, HCI_ERROR_AUTH_FAILURE); hci_conn_drop(conn); + conn->state = BT_DISCONN; goto unlock; } @@ -5248,6 +5250,7 @@ static void hci_key_refresh_complete_evt(struct hci_dev *hdev, void *data, if (ev->status && conn->state == BT_CONNECTED) { hci_disconnect(conn, HCI_ERROR_AUTH_FAILURE); hci_conn_drop(conn); + conn->state = BT_DISCONN; goto unlock; }