Message ID | 20210831065601.101185-1-desmondcheongzx@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Bluetooth: fix race in sco_sock_connect | expand |
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=539595 ---Test result--- Test Summary: CheckPatch FAIL 0.68 seconds GitLint FAIL 0.14 seconds BuildKernel PASS 705.55 seconds TestRunner: Setup PASS 471.63 seconds TestRunner: l2cap-tester PASS 3.08 seconds TestRunner: bnep-tester PASS 2.24 seconds TestRunner: mgmt-tester PASS 35.49 seconds TestRunner: rfcomm-tester PASS 2.55 seconds TestRunner: sco-tester PASS 2.43 seconds TestRunner: smp-tester PASS 2.55 seconds TestRunner: userchan-tester PASS 2.30 seconds Details ############################## Test: CheckPatch - FAIL - 0.68 seconds Run checkpatch.pl script with rule in .checkpatch.conf Bluetooth: fix race in sco_sock_connect WARNING: Possible unwrapped commit description (prefer a maximum 75 chars per line) #19: Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 WARNING: Possible repeated word: 'Google' #19: Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 total: 0 errors, 2 warnings, 0 checks, 22 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. "[PATCH] Bluetooth: fix race in sco_sock_connect" has style problems, please review. NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. ############################## Test: GitLint - FAIL - 0.14 seconds Run gitlint with rule in .gitlint Bluetooth: fix race in sco_sock_connect 6: B1 Line exceeds max length (100>80): "BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:101 [inline]" 7: B1 Line exceeds max length (109>80): "BUG: KASAN: use-after-free in atomic_fetch_add_relaxed include/asm-generic/atomic-instrumented.h:111 [inline]" 8: B1 Line exceeds max length (82>80): "BUG: KASAN: use-after-free in __refcount_add include/linux/refcount.h:193 [inline]" 9: B1 Line exceeds max length (82>80): "BUG: KASAN: use-after-free in __refcount_inc include/linux/refcount.h:250 [inline]" 16: B1 Line exceeds max length (89>80): "Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011" 127: B1 Line exceeds max length (90>80): "page:ffffea0000d2d000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x34b40" 134: B1 Line exceeds max length (195>80): "page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 8634, ts 417197903424, free_ts 417180376519" ############################## Test: BuildKernel - PASS - 705.55 seconds Build Kernel with minimal configuration supports Bluetooth ############################## Test: TestRunner: Setup - PASS - 471.63 seconds Setup environment for running Test Runner ############################## Test: TestRunner: l2cap-tester - PASS - 3.08 seconds Run test-runner with l2cap-tester Total: 40, Passed: 40 (100.0%), Failed: 0, Not Run: 0 ############################## Test: TestRunner: bnep-tester - PASS - 2.24 seconds Run test-runner with bnep-tester Total: 1, Passed: 1 (100.0%), Failed: 0, Not Run: 0 ############################## Test: TestRunner: mgmt-tester - PASS - 35.49 seconds Run test-runner with mgmt-tester Total: 452, Passed: 452 (100.0%), Failed: 0, Not Run: 0 ############################## Test: TestRunner: rfcomm-tester - PASS - 2.55 seconds Run test-runner with rfcomm-tester Total: 9, Passed: 9 (100.0%), Failed: 0, Not Run: 0 ############################## Test: TestRunner: sco-tester - PASS - 2.43 seconds Run test-runner with sco-tester Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0 ############################## Test: TestRunner: smp-tester - PASS - 2.55 seconds Run test-runner with smp-tester Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0 ############################## Test: TestRunner: userchan-tester - PASS - 2.30 seconds Run test-runner with userchan-tester Total: 3, Passed: 3 (100.0%), Failed: 0, Not Run: 0 --- Regards, Linux Bluetooth
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index 98a881586512..fa25b07120c9 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c @@ -578,9 +578,6 @@ static int sco_sock_connect(struct socket *sock, struct sockaddr *addr, int alen addr->sa_family != AF_BLUETOOTH) return -EINVAL; - if (sk->sk_state != BT_OPEN && sk->sk_state != BT_BOUND) - return -EBADFD; - if (sk->sk_type != SOCK_SEQPACKET) return -EINVAL; @@ -591,6 +588,13 @@ static int sco_sock_connect(struct socket *sock, struct sockaddr *addr, int alen lock_sock(sk); + if (sk->sk_state != BT_OPEN && sk->sk_state != BT_BOUND) { + hci_dev_unlock(hdev); + hci_dev_put(hdev); + err = -EBADFD; + goto done; + } + /* Set destination address and psm */ bacpy(&sco_pi(sk)->dst, &sa->sco_bdaddr);