Message ID | 20240102180810.54515-1-verdre@v0yd.nl (mailing list archive) |
---|---|
State | Accepted |
Commit | 626cef40faf0b363be5d552800adb5845774662b |
Headers | show |
Series | Bluetooth: hci_sync: Check the correct flag before starting a scan | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | success | Success |
tedd_an/CheckPatch | warning | WARNING: Prefer a maximum 75 chars per line (possible unwrapped commit description?) #44: calling hci_dev_test_flag() to test for HCI_INQUIRY, but hci_dev_test_flag() total: 0 errors, 1 warnings, 0 checks, 8 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/13509236.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. |
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 | success | CheckSparse PASS |
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 | success | TestRunner PASS |
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 |
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=813894 ---Test result--- Test Summary: CheckPatch FAIL 1.06 seconds GitLint PASS 0.31 seconds SubjectPrefix PASS 0.12 seconds BuildKernel PASS 27.86 seconds CheckAllWarning PASS 30.62 seconds CheckSparse PASS 36.10 seconds CheckSmatch PASS 99.51 seconds BuildKernel32 PASS 27.13 seconds TestRunnerSetup PASS 435.46 seconds TestRunner_l2cap-tester PASS 22.92 seconds TestRunner_iso-tester PASS 45.88 seconds TestRunner_bnep-tester PASS 6.82 seconds TestRunner_mgmt-tester PASS 163.22 seconds TestRunner_rfcomm-tester PASS 10.99 seconds TestRunner_sco-tester PASS 14.45 seconds TestRunner_ioctl-tester PASS 12.15 seconds TestRunner_mesh-tester PASS 8.76 seconds TestRunner_smp-tester PASS 10.26 seconds TestRunner_userchan-tester PASS 7.34 seconds IncrementalBuild PASS 26.22 seconds Details ############################## Test: CheckPatch - FAIL Desc: Run checkpatch.pl script Output: Bluetooth: hci_sync: Check the correct flag before starting a scan WARNING: Prefer a maximum 75 chars per line (possible unwrapped commit description?) #44: calling hci_dev_test_flag() to test for HCI_INQUIRY, but hci_dev_test_flag() total: 0 errors, 1 warnings, 0 checks, 8 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/13509236.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. --- Regards, Linux Bluetooth
On Tue, Jan 02, 2024 at 07:08:08PM +0100, Jonas Dreßler wrote: > There's a very confusing mistake in the code starting a HCI inquiry: We're > calling hci_dev_test_flag() to test for HCI_INQUIRY, but hci_dev_test_flag() > checks hdev->dev_flags instead of hdev->flags. HCI_INQUIRY is a bit that's > set on hdev->flags, not on hdev->dev_flags though. > > HCI_INQUIRY equals the integer 7, and in hdev->dev_flags, 7 means > HCI_BONDABLE, so we were actually checking for HCI_BONDABLE here. > > The mistake is only present in the synchronous code for starting an inquiry, > not in the async one. Also devices are typically bondable while doing an > inquiry, so that might be the reason why nobody noticed it so far. > > Signed-off-by: Jonas Dreßler <verdre@v0yd.nl> FWIIW, I agree with this analysis and the proposed fix looks correct to me. Reviewed-by: Simon Horman <horms@kernel.org> I do wonder if it is appropriate to treat this as a bug fix - is there a use-visible problem? If so, the following seems appropriate to me. Fixes: abfeea476c68 ("Bluetooth: hci_sync: Convert MGMT_OP_START_DISCOVERY") ...
Hello: This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>: On Tue, 2 Jan 2024 19:08:08 +0100 you wrote: > There's a very confusing mistake in the code starting a HCI inquiry: We're > calling hci_dev_test_flag() to test for HCI_INQUIRY, but hci_dev_test_flag() > checks hdev->dev_flags instead of hdev->flags. HCI_INQUIRY is a bit that's > set on hdev->flags, not on hdev->dev_flags though. > > HCI_INQUIRY equals the integer 7, and in hdev->dev_flags, 7 means > HCI_BONDABLE, so we were actually checking for HCI_BONDABLE here. > > [...] Here is the summary with links: - Bluetooth: hci_sync: Check the correct flag before starting a scan https://git.kernel.org/bluetooth/bluetooth-next/c/626cef40faf0 You are awesome, thank you!
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index c920de0a2..4a5949a0e 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -5554,7 +5554,7 @@ static int hci_inquiry_sync(struct hci_dev *hdev, u8 length) bt_dev_dbg(hdev, ""); - if (hci_dev_test_flag(hdev, HCI_INQUIRY)) + if (test_bit(HCI_INQUIRY, &hdev->flags)) return 0; hci_dev_lock(hdev);
There's a very confusing mistake in the code starting a HCI inquiry: We're calling hci_dev_test_flag() to test for HCI_INQUIRY, but hci_dev_test_flag() checks hdev->dev_flags instead of hdev->flags. HCI_INQUIRY is a bit that's set on hdev->flags, not on hdev->dev_flags though. HCI_INQUIRY equals the integer 7, and in hdev->dev_flags, 7 means HCI_BONDABLE, so we were actually checking for HCI_BONDABLE here. The mistake is only present in the synchronous code for starting an inquiry, not in the async one. Also devices are typically bondable while doing an inquiry, so that might be the reason why nobody noticed it so far. Signed-off-by: Jonas Dreßler <verdre@v0yd.nl> --- net/bluetooth/hci_sync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)