Bluetooth: hci_ldisc: check HCI_UART_PROTO_READY flag in HCIUARTGETPROTO
PATCH 1/1 Bluetooth: hci_ldisc: check HCI_UART_PROTO_READY flag in HCIUARTGETPROTO
This patch adds code to check HCI_UART_PROTO_READY flag before accessing hci_uart->proto. It fixs the race condition in hci_uart_tty_ioctl() between HCIUARTSETPROTO and HCIUARTGETPROTO. This issue bug found by Yu Hao and Weiteng Chen:
BUG: general protection fault in hci_uart_tty_ioctl [1]
The information of C reproducer can also reference the link [2]
--- drivers/bluetooth/hci_ldisc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/bluetooth/hci_ldisc.c +2 -1
@@ -770,7 +770,8 @@ static int hci_uart_tty_ioctl(struct tty_struct *tty, unsigned int cmd,break ;case HCIUARTGETPROTO : -if (test_bit (HCI_UART_PROTO_SET , &hu->flags)) +if (test_bit (HCI_UART_PROTO_SET , &hu->flags) && +test_bit (HCI_UART_PROTO_READY , &hu->flags)) err = hu->proto->id;else err = -EUNATCH ;
Signature · 1 line
2.35.3
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=764081
---Test result---
Test Summary:
CheckPatch FAIL 0.84 seconds GitLint FAIL 0.51 seconds SubjectPrefix PASS 0.09 seconds BuildKernel PASS 33.31 seconds CheckAllWarning PASS 36.54 seconds CheckSparse PASS 41.27 seconds CheckSmatch PASS 114.64 seconds BuildKernel32 PASS 32.48 seconds TestRunnerSetup PASS 487.10 seconds TestRunner_l2cap-tester PASS 22.77 seconds TestRunner_iso-tester PASS 40.83 seconds TestRunner_bnep-tester PASS 10.48 seconds TestRunner_mgmt-tester PASS 211.04 seconds TestRunner_rfcomm-tester PASS 15.72 seconds TestRunner_sco-tester PASS 16.73 seconds TestRunner_ioctl-tester PASS 17.64 seconds TestRunner_mesh-tester PASS 12.98 seconds TestRunner_smp-tester PASS 13.90 seconds TestRunner_userchan-tester PASS 10.94 seconds IncrementalBuild PASS 30.52 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
Bluetooth: hci_ldisc: check HCI_UART_PROTO_READY flag in HCIUARTGETPROTO
WARNING: From:/Signed-off-by: email address mismatch: 'From: "Lee, Chun-Yi" <[email protected]>' != 'Signed-off-by: "Lee, Chun-Yi" <[email protected]>'
total: 0 errors, 1 warnings, 9 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.
/github/workspace/src/src/13307193.patch has style problems, please review.
NOTE: Ignored message types: UNKNOWN_COMMIT_ID
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
Bluetooth: hci_ldisc: check HCI_UART_PROTO_READY flag in HCIUARTGETPROTO
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
13: B1 Line exceeds max length (107>80): "Closes: https://lore.kernel.org/all/CA+UBctC3p49aTgzbVgkSZ2+TQcqq4fPDO7yZitFT5uBPDeCO2g@mail.gmail.com/ [1]"
15: B1 Line exceeds max length (110>80): "Closes: https://lore.kernel.org/lkml/CA+UBctDPEvHdkHMwD340=n02rh+jNRJNNQ5LBZNA+Wm4Keh2ow@mail.gmail.com/T/ [2]"
---
Regards,
Linux Bluetooth
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 8 lines · On Mon, 10 Jul 2023 23:17:23 +0800 you wrote:
This patch adds code to check
HCI_UART_PROTO_READYflag before accessinghci_uart->proto. It fixs the race condition inhci_uart_tty_ioctl()between HCIUARTSETPROTO and HCIUARTGETPROTO. This issue bug found by Yu Hao and Weiteng Chen:BUG: general protection fault in hci_uart_tty_ioctl [1][...]
Here is the summary with links:
- Bluetooth: hci_ldisc: check HCI_UART_PROTO_READY flag in HCIUARTGETPROTO
https://git.kernel.org/bluetooth/bluetooth-next/c/ff1b86784849
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html