* [PATCH] Bluetooth: Add new quirk for broken read key length on ATS2851
@ 2024-02-27 1:43 Vinicius Peixoto
2024-02-27 2:38 ` bluez.test.bot
2024-03-04 21:40 ` [PATCH] " patchwork-bot+bluetooth
0 siblings, 2 replies; 3+ messages in thread
From: Vinicius Peixoto @ 2024-02-27 1:43 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Johan Hedberg,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: linux-bluetooth, linux-kernel, netdev, Vinicius Peixoto
The ATS2851 controller erroneously reports support for the "Read
Encryption Key Length" HCI command. This makes it unable to connect
to any devices, since this command is issued by the kernel during the
connection process in response to an "Encryption Change" HCI event.
Add a new quirk (HCI_QUIRK_BROKEN_ENC_KEY_SIZE) to hint that the command
is unsupported, preventing it from interrupting the connection process.
This is the error log from btmon before this patch:
> HCI Event: Encryption Change (0x08) plen 4
Status: Success (0x00)
Handle: 2048 Address: ...
Encryption: Enabled with E0 (0x01)
< HCI Command: Read Encryption Key Size (0x05|0x0008) plen 2
Handle: 2048 Address: ...
> HCI Event: Command Status (0x0f) plen 4
Read Encryption Key Size (0x05|0x0008) ncmd 1
Status: Unknown HCI Command (0x01)
Signed-off-by: Vinicius Peixoto <nukelet64@gmail.com>
---
drivers/bluetooth/btusb.c | 1 +
include/net/bluetooth/hci.h | 8 ++++++++
net/bluetooth/hci_event.c | 3 ++-
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index edfb49bbaa28..96c9318c0874 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -4489,6 +4489,7 @@ static int btusb_probe(struct usb_interface *intf,
set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
set_bit(HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT, &hdev->quirks);
set_bit(HCI_QUIRK_BROKEN_EXT_SCAN, &hdev->quirks);
+ set_bit(HCI_QUIRK_BROKEN_READ_ENC_KEY_SIZE, &hdev->quirks);
}
if (!reset)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 08cb5cb249a4..33b5da0830e2 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -330,6 +330,14 @@ enum {
* during the hdev->setup vendor callback.
*/
HCI_QUIRK_BROKEN_LE_CODED,
+
+ /*
+ * When this quirk is set, the HCI_OP_READ_ENC_KEY_SIZE command is
+ * skipped during an HCI_EV_ENCRYPT_CHANGE event. This is required
+ * for Actions Semiconductor ATS2851 based controllers, which erroneously
+ * claim to support it.
+ */
+ HCI_QUIRK_BROKEN_READ_ENC_KEY_SIZE,
};
/* HCI device flags */
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index bffd2c7ff608..4ae224824012 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -3641,7 +3641,8 @@ static void hci_encrypt_change_evt(struct hci_dev *hdev, void *data,
* controller really supports it. If it doesn't, assume
* the default size (16).
*/
- if (!(hdev->commands[20] & 0x10)) {
+ if (!(hdev->commands[20] & 0x10) ||
+ test_bit(HCI_QUIRK_BROKEN_READ_ENC_KEY_SIZE, &hdev->quirks)) {
conn->enc_key_size = HCI_LINK_KEY_SIZE;
goto notify;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: Bluetooth: Add new quirk for broken read key length on ATS2851
2024-02-27 1:43 [PATCH] Bluetooth: Add new quirk for broken read key length on ATS2851 Vinicius Peixoto
@ 2024-02-27 2:38 ` bluez.test.bot
2024-03-04 21:40 ` [PATCH] " patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2024-02-27 2:38 UTC (permalink / raw)
To: linux-bluetooth, nukelet64
[-- Attachment #1: Type: text/plain, Size: 2359 bytes --]
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=830105
---Test result---
Test Summary:
CheckPatch PASS 0.99 seconds
GitLint PASS 0.28 seconds
SubjectPrefix PASS 0.10 seconds
BuildKernel PASS 30.69 seconds
CheckAllWarning PASS 33.84 seconds
CheckSparse WARNING 39.30 seconds
CheckSmatch WARNING 105.60 seconds
BuildKernel32 PASS 29.51 seconds
TestRunnerSetup PASS 541.18 seconds
TestRunner_l2cap-tester FAIL 25.55 seconds
TestRunner_iso-tester FAIL 43.79 seconds
TestRunner_bnep-tester PASS 4.90 seconds
TestRunner_mgmt-tester PASS 119.65 seconds
TestRunner_rfcomm-tester PASS 7.56 seconds
TestRunner_sco-tester PASS 15.13 seconds
TestRunner_ioctl-tester PASS 8.38 seconds
TestRunner_mesh-tester PASS 6.24 seconds
TestRunner_smp-tester PASS 7.24 seconds
TestRunner_userchan-tester PASS 5.27 seconds
IncrementalBuild PASS 29.23 seconds
Details
##############################
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 - WARNING
Desc: Run smatch tool with source
Output:
net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):
##############################
Test: TestRunner_l2cap-tester - FAIL
Desc: Run l2cap-tester with test-runner
Output:
Total: 51, Passed: 50 (98.0%), Failed: 1, Not Run: 0
Failed Test Cases
L2CAP LE Client - Close socket 2 Timed out 2.554 seconds
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
Total: 117, Passed: 116 (99.1%), Failed: 1, Not Run: 0
Failed Test Cases
ISO Connect2 Suspend - Success Timed out 12.278 seconds
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: Add new quirk for broken read key length on ATS2851
2024-02-27 1:43 [PATCH] Bluetooth: Add new quirk for broken read key length on ATS2851 Vinicius Peixoto
2024-02-27 2:38 ` bluez.test.bot
@ 2024-03-04 21:40 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2024-03-04 21:40 UTC (permalink / raw)
To: Vinicius Peixoto
Cc: marcel, luiz.dentz, johan.hedberg, davem, edumazet, kuba, pabeni,
linux-bluetooth, linux-kernel, netdev
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Mon, 26 Feb 2024 22:43:26 -0300 you wrote:
> The ATS2851 controller erroneously reports support for the "Read
> Encryption Key Length" HCI command. This makes it unable to connect
> to any devices, since this command is issued by the kernel during the
> connection process in response to an "Encryption Change" HCI event.
>
> Add a new quirk (HCI_QUIRK_BROKEN_ENC_KEY_SIZE) to hint that the command
> is unsupported, preventing it from interrupting the connection process.
>
> [...]
Here is the summary with links:
- Bluetooth: Add new quirk for broken read key length on ATS2851
https://git.kernel.org/bluetooth/bluetooth-next/c/88f741deaa76
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-03-04 21:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-27 1:43 [PATCH] Bluetooth: Add new quirk for broken read key length on ATS2851 Vinicius Peixoto
2024-02-27 2:38 ` bluez.test.bot
2024-03-04 21:40 ` [PATCH] " patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).