Bluetooth: btrtl: Avoid loading the config file on security chips
PATCH 1/1 Bluetooth: btrtl: Avoid loading the config file on security chips
For chips with security enabled, it's only possible to load firmware with a valid signature pattern.
- Example log for a security chip.
Bluetooth: hci0: RTL: examining hci_ver=0c hci_rev=000a
lmp_ver=0c lmp_subver=8922
Bluetooth: hci0: RTL: rom_version status=0 version=1
Bluetooth: hci0: RTL: loading rtl_bt/rtl8922au_fw.bin
Bluetooth: hci0: RTL: cfg_sz 0, total sz 71301
Bluetooth: hci0: RTL: fw version 0x41c0c905
- Example log for a normal chip.
Bluetooth: hci0: RTL: examining hci_ver=0c hci_rev=000a
lmp_ver=0c lmp_subver=8922
Bluetooth: hci0: RTL: rom_version status=0 version=1
Bluetooth: hci0: RTL: loading rtl_bt/rtl8922au_fw.bin
Bluetooth: hci0: RTL: loading rtl_bt/rtl8922au_config.bin
Bluetooth: hci0: RTL: cfg_sz 6, total sz 71307
Bluetooth: hci0: RTL: fw version 0x41c0c905
--- drivers/bluetooth/btrtl.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
drivers/bluetooth/btrtl.c +13 -11
@@ -50,7 +50,7 @@#define RTL_CHIP_SUBVER (&(struct rtl_vendor_cmd) {{0x10, 0x38, 0x04, 0x28, 0x80}})#define RTL_CHIP_REV (&(struct rtl_vendor_cmd) {{0x10, 0x3A, 0x04, 0x28, 0x80}}) -#define RTL_SEC_PROJ (&(struct rtl_vendor_cmd) {{0x10, 0xA4, 0x0D, 0x00, 0xb0}}) +#define RTL_SEC_PROJ (&(struct rtl_vendor_cmd) {{0x10, 0xA4, 0xAD, 0x00, 0xb0}})#define RTL_PATCH_SNIPPETS 0x01#define RTL_PATCH_DUMMY_HEADER 0x02
@@ -544,7 +544,6 @@ static int rtlbt_parse_firmware_v2(struct hci_dev *hdev, {struct rtl_epatch_header_v2 *hdr;int rc; -u8 reg_val[2 ];u8 key_id;u32 num_sections;struct rtl_section *section;
@@ -559,14 +558,7 @@ static int rtlbt_parse_firmware_v2(struct hci_dev *hdev, .len = btrtl_dev->fw_len - 7, /* Cut the tail */ }; - rc =btrtl_vendor_read_reg16 (hdev,RTL_SEC_PROJ , reg_val); -if (rc <0 ) -return -EIO ; - key_id = reg_val[0 ]; - -rtl_dev_dbg (hdev,"%s: key id %u" , __func__, key_id); - - btrtl_dev->key_id = key_id; + key_id = btrtl_dev->key_id; hdr =rtl_iov_pull_data (&iov,sizeof (*hdr));if (!hdr)
@@ -1081,6 +1073,8 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,u16 hci_rev, lmp_subver;u8 hci_ver, lmp_ver, chip_type =0 ;int ret; +int rc; +u8 key_id;u8 reg_val[2 ]; btrtl_dev =kzalloc (sizeof (*btrtl_dev),GFP_KERNEL );
@@ -1191,6 +1185,14 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev, goto err_free; } + rc =btrtl_vendor_read_reg16 (hdev,RTL_SEC_PROJ , reg_val); +if (rc <0 ) + goto err_free; + + key_id = reg_val[0 ]; + btrtl_dev->key_id = key_id; +rtl_dev_dbg (hdev,"%s: key id %u" , __func__, key_id); + btrtl_dev->fw_len = -EIO ;if (lmp_subver ==RTL_ROM_LMP_8852A && hci_rev ==0x000c ) { snprintf(fw_name, sizeof(fw_name), "%s_v2.bin",
@@ -1213,7 +1215,7 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev, goto err_free; } -if (btrtl_dev->ic_info->cfg_name) { +if (btrtl_dev->ic_info->cfg_name && !btrtl_dev->key_id) {if (postfix) {snprintf (cfg_name,sizeof (cfg_name),"%s-%s.bin" , btrtl_dev->ic_info->cfg_name, postfix);
Signature · 1 line
2.43.0
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=1019729
---Test result---
Test Summary:
CheckPatch PENDING 0.48 seconds GitLint PENDING 0.34 seconds SubjectPrefix PASS 0.06 seconds BuildKernel PASS 26.12 seconds CheckAllWarning PASS 28.34 seconds CheckSparse PASS 31.18 seconds BuildKernel32 PASS 25.60 seconds TestRunnerSetup PASS 504.78 seconds TestRunner_l2cap-tester PASS 24.09 seconds TestRunner_iso-tester PASS 84.29 seconds TestRunner_bnep-tester PASS 6.10 seconds TestRunner_mgmt-tester FAIL 110.78 seconds TestRunner_rfcomm-tester PASS 9.30 seconds TestRunner_sco-tester PASS 12.69 seconds TestRunner_ioctl-tester PASS 11.40 seconds TestRunner_mesh-tester FAIL 11.53 seconds TestRunner_smp-tester PASS 8.42 seconds TestRunner_userchan-tester PASS 6.81 seconds IncrementalBuild PENDING 0.80 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner Output:
Total: 490, Passed: 484 (98.8%), Failed: 2, Not Run: 4
Failed Test Cases
Read Exp Feature - Success Failed 0.107 seconds LL Privacy - Set Device Flag 1 (Device Privacy) Failed 0.159 seconds
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner Output:
Total: 10, Passed: 8 (80.0%), Failed: 2, Not Run: 0
Failed Test Cases
Mesh - Send cancel - 1 Timed out 1.894 seconds Mesh - Send cancel - 2 Timed out 1.998 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:
---
Regards,
Linux Bluetooth
Dear Max,
Thank you for your patch.
Am 05.11.25 um 07:37 schrieb Max Chou:
Quoted 2 lines
For chips with security enabled, it's only possible to load firmware with a valid signature pattern.
How can security be enabled?
What is currently logged? An error?
Please go into the changes. What is the vendor command 0xAD over 0x0D?
Quoted 88 lines
- Example log for a security chip.
Bluetooth: hci0: RTL: examining hci_ver=0c hci_rev=000a
lmp_ver=0c lmp_subver=8922
Bluetooth: hci0: RTL:rom_versionstatus=0 version=1
Bluetooth: hci0: RTL: loading rtl_bt/rtl8922au_fw.bin
Bluetooth: hci0: RTL:cfg_sz0, total sz 71301
Bluetooth: hci0: RTL: fw version0x41c0c905- Example log for a normal chip.
Bluetooth: hci0: RTL: examining hci_ver=0c hci_rev=000a
lmp_ver=0c lmp_subver=8922
Bluetooth: hci0: RTL:rom_versionstatus=0 version=1
Bluetooth: hci0: RTL: loading rtl_bt/rtl8922au_fw.bin
Bluetooth: hci0: RTL: loading rtl_bt/rtl8922au_config.bin
Bluetooth: hci0: RTL:cfg_sz6, total sz 71307
Bluetooth: hci0: RTL: fw version0x41c0c905Tested-by Hilda Wu <[email protected]>Signed-off-by Nial Ni <[email protected]>Signed-off-by Max Chou <[email protected]>--- drivers/bluetooth/btrtl.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)drivers/bluetooth/btrtl.c +12
-10@@ -50,7 +50,7 @@#define RTL_CHIP_SUBVER (&(struct rtl_vendor_cmd) {{0x10, 0x38, 0x04, 0x28, 0x80}})#define RTL_CHIP_REV (&(struct rtl_vendor_cmd) {{0x10, 0x3A, 0x04, 0x28, 0x80}}) -#define RTL_SEC_PROJ (&(struct rtl_vendor_cmd) {{0x10, 0xA4, 0x0D, 0x00, 0xb0}}) +#define RTL_SEC_PROJ (&(struct rtl_vendor_cmd) {{0x10, 0xA4, 0xAD, 0x00, 0xb0}})#define RTL_PATCH_SNIPPETS 0x01#define RTL_PATCH_DUMMY_HEADER 0x02@@ -544,7 +544,6 @@ static int rtlbt_parse_firmware_v2(struct hci_dev *hdev, {struct rtl_epatch_header_v2 *hdr;int rc; -u8 reg_val[2 ];u8 key_id;u32 num_sections;struct rtl_section *section;@@ -559,14 +558,7 @@ static int rtlbt_parse_firmware_v2(struct hci_dev *hdev, .len = btrtl_dev->fw_len - 7, /* Cut the tail */ }; - rc =btrtl_vendor_read_reg16 (hdev,RTL_SEC_PROJ , reg_val); -if (rc <0 ) -return -EIO ; - key_id = reg_val[0 ]; - -rtl_dev_dbg (hdev,"%s: key id %u" , __func__, key_id); - - btrtl_dev->key_id = key_id; + key_id = btrtl_dev->key_id; hdr =rtl_iov_pull_data (&iov,sizeof (*hdr));if (!hdr)@@ -1081,6 +1073,8 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,u16 hci_rev, lmp_subver;u8 hci_ver, lmp_ver, chip_type =0 ;int ret; +int rc; +u8 key_id;u8 reg_val[2 ]; btrtl_dev =kzalloc (sizeof (*btrtl_dev),GFP_KERNEL );@@ -1191,6 +1185,14 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev, goto err_free; } + rc =btrtl_vendor_read_reg16 (hdev,RTL_SEC_PROJ , reg_val); +if (rc <0 ) + goto err_free; + + key_id = reg_val[0 ]; + btrtl_dev->key_id = key_id; +rtl_dev_dbg (hdev,"%s: key id %u" , __func__, key_id); + btrtl_dev->fw_len = -EIO ;if (lmp_subver ==RTL_ROM_LMP_8852A && hci_rev ==0x000c ) { snprintf(fw_name, sizeof(fw_name), "%s_v2.bin",
drivers/bluetooth/btrtl.c struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev, · line 1218
Quoted 5 lines
drivers/bluetooth/btrtl.c +1
-1@@ -1213,7 +1215,7 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev, goto err_free; } -if (btrtl_dev->ic_info->cfg_name) { +if (btrtl_dev->ic_info->cfg_name && !btrtl_dev->key_id) {
So on non-security enabled chips, key_id is 0? It’d be great if that could be made clear in the commit message.
drivers/bluetooth/btrtl.c struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev, · line 1221
Quoted 3 lines
drivers/bluetooth/btrtl.c +0
-0if (postfix) {snprintf (cfg_name,sizeof (cfg_name),"%s-%s.bin" , btrtl_dev->ic_info->cfg_name, postfix);
Kind regards,
Paul
Hi! Paul,
Thanks for your response.
Please check my comments inline.
Quoted 24 lines
-----Original Message-----
From: Paul Menzel [mailto:[email protected]]
Sent: Wednesday, November 5, 2025 3:58 PM
To: Max Chou <[email protected]>
Cc: Marcel Holtmann <[email protected]>; Luiz Augusto von Dentz <[email protected]>; [email protected]; linux- [email protected]; Hilda Wu <[email protected]>; [email protected]; [email protected]; KidmanLee <[email protected]>
Subject: Re: [PATCH] Bluetooth: btrtl: Avoid loading the config file on security chipsExternal mail : This email originated from outside the organization. Do not reply, click links, or open attachments unless you recognize the sender and know the content is safe.
Dear Max,
Thank you for your patch.
Quoted 7 lines
Am 05.11.25 um 07:37 schrieb Max Chou:
Quoted 2 lines
For chips with security enabled, it's only possible to load firmware with a valid signature pattern.
How can security be enabled?
What is currently logged? An error?
The security chips will be shipped to specific brand customers and are managed by an eFuse, which is programmed during manufacturing. Currently, loading the config file causes initialization to fail on security chips.
The security chips can only load firmware files that contain a valid signature.
Quoted 3 lines
Please go into the changes. What is the vendor command
0xADover0x0D?
Actually, the current value is incorrect. The correct value for the parameters of the vendor command is 0xAD.
Quoted 96 lines
Quoted 31 lines
- Example log for a security chip.
Bluetooth: hci0: RTL: examining hci_ver=0c hci_rev=000a
lmp_ver=0c lmp_subver=8922
Bluetooth: hci0: RTL:rom_versionstatus=0 version=1
Bluetooth: hci0: RTL: loading rtl_bt/rtl8922au_fw.bin
Bluetooth: hci0: RTL:cfg_sz0, total sz 71301
Bluetooth: hci0: RTL: fw version0x41c0c905- Example log for a normal chip.
Bluetooth: hci0: RTL: examining hci_ver=0c hci_rev=000a
lmp_ver=0c lmp_subver=8922
Bluetooth: hci0: RTL:rom_versionstatus=0 version=1
Bluetooth: hci0: RTL: loading rtl_bt/rtl8922au_fw.bin
Bluetooth: hci0: RTL: loading rtl_bt/rtl8922au_config.bin
Bluetooth: hci0: RTL:cfg_sz6, total sz 71307
Bluetooth: hci0: RTL: fw version0x41c0c905Tested-by Hilda Wu <[email protected]>Signed-off-by Nial Ni <[email protected]>Signed-off-by Max Chou <[email protected]>--- drivers/bluetooth/btrtl.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)drivers/bluetooth/btrtl.c +0
-0drivers/bluetooth/btrtl.c line 51
Quoted 2 lines
drivers/bluetooth/btrtl.c +0
-0@@ -50,7 +50,7 @@#define RTL_CHIP_SUBVER (&(struct rtl_vendor_cmd) {{0x10, 0x38, 0x04,
0x28,0x80}})drivers/bluetooth/btrtl.c line 52
Quoted 1 line
drivers/bluetooth/btrtl.c +0
-0#define RTL_CHIP_REV (&(struct rtl_vendor_cmd) {{0x10, 0x3A, 0x04,
0x28,0x80}})drivers/bluetooth/btrtl.c line 53
Quoted 1 line
drivers/bluetooth/btrtl.c +0
-1-#define RTL_SEC_PROJ (&(struct rtl_vendor_cmd) {{0x10, 0xA4, 0x0D,
0x00,0xb0}})drivers/bluetooth/btrtl.c line 53
Quoted 1 line
drivers/bluetooth/btrtl.c +1
-0+#define RTL_SEC_PROJ (&(struct rtl_vendor_cmd) {{0x10, 0xA4, 0xAD,
0x00,0xb0}})drivers/bluetooth/btrtl.c static int rtlbt_parse_firmware_v2(struct hci_dev
Quoted 4 lines
drivers/bluetooth/btrtl.c +0
-0#define RTL_PATCH_SNIPPETS 0x01#define RTL_PATCH_DUMMY_HEADER 0x02@@ -544,7 +544,6 @@ static int rtlbt_parse_firmware_v2(struct hci_dev*hdev,
drivers/bluetooth/btrtl.c static int rtlbt_parse_firmware_v2(struct hci_dev
Quoted 8 lines
drivers/bluetooth/btrtl.c +0
-1{struct rtl_epatch_header_v2 *hdr;int rc; -u8 reg_val[2 ];u8 key_id;u32 num_sections;struct rtl_section *section;@@ -559,14 +558,7 @@ static int rtlbt_parse_firmware_v2(struct hci_dev*hdev,
drivers/bluetooth/btrtl.c struct btrtl_device_info *btrtl_initialize(struct
Quoted 16 lines
drivers/bluetooth/btrtl.c +1
-8.len = btrtl_dev->fw_len - 7, /* Cut the tail */ }; - rc =btrtl_vendor_read_reg16 (hdev,RTL_SEC_PROJ , reg_val); -if (rc <0 ) -return -EIO ; - key_id = reg_val[0 ]; - -rtl_dev_dbg (hdev,"%s: key id %u" , __func__, key_id); - - btrtl_dev->key_id = key_id; + key_id = btrtl_dev->key_id; hdr =rtl_iov_pull_data (&iov,sizeof (*hdr));if (!hdr)@@ -1081,6 +1073,8 @@ struct btrtl_device_info *btrtl_initialize(struct
hci_dev*hdev,Quoted 14 lines
drivers/bluetooth/btrtl.c +5
-0u16 hci_rev, lmp_subver;u8 hci_ver, lmp_ver, chip_type =0 ;int ret; +int rc; +u8 key_id;u8 reg_val[2 ]; btrtl_dev = kzalloc(sizeof(*btrtl_dev), GFP_KERNEL); @@ -1191,6 +1185,14 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev, goto err_free; } + rc =btrtl_vendor_read_reg16 (hdev,RTL_SEC_PROJ , reg_val); +if (rc <0 )drivers/bluetooth/btrtl.c struct btrtl_device_info *btrtl_initialize(struct
Quoted 10 lines
drivers/bluetooth/btrtl.c +6
-1+ goto err_free; + + key_id = reg_val[0 ]; + btrtl_dev->key_id = key_id; +rtl_dev_dbg (hdev,"%s: key id %u" , __func__, key_id); + btrtl_dev->fw_len = -EIO ;if (lmp_subver ==RTL_ROM_LMP_8852A && hci_rev ==0x000c ) { snprintf(fw_name, sizeof(fw_name), "%s_v2.bin", @@ -1213,7 +1215,7 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev*hdev,
Quoted 8 lines
drivers/bluetooth/btrtl.c struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev, · line 1218
Quoted 5 lines
goto err_free; }drivers/bluetooth/btrtl.c +1
-1-if (btrtl_dev->ic_info->cfg_name) { +if (btrtl_dev->ic_info->cfg_name && !btrtl_dev->key_id) {So on non-security enabled chips,
key_idis 0? It’d be great if that could be made clear in the commit message.
As you understood, key_id is 0 for normal chips.
I will add this information to the commit log in the v2 patch.
Quoted 9 lines
Quoted 4 lines
if (postfix) { snprintf(cfg_name, sizeof(cfg_name), "%s-%s.bin", btrtl_dev->ic_info->cfg_name, postfix);Kind regards,
Paul
BRs,
Max
Dear Max,
Thank you for your reply, and thank you for sending out v2.
Am 05.11.25 um 10:19 schrieb Max Chou:
[…]
Quoted 8 lines
Quoted 8 lines
-----Original Message-----
From: Paul Menzel [mailto:[email protected]]
Sent: Wednesday, November 5, 2025 3:58 PMAm 05.11.25 um 07:37 schrieb Max Chou:
Quoted 2 lines
For chips with security enabled, it's only possible to load firmware with a valid signature pattern.
Quoted 6 lines
Quoted 3 lines
How can security be enabled?
What is currently logged? An error?
The security chips will be shipped to specific brand customers and
are managed by an eFuse, which is programmed during manufacturing.> Currently, loading the config file causes initialization to fail on
security chips.
Quoted 6 lines
The security chips can only load firmware files that contain a valid signature.
Quoted 1 line
Please go into the changes. What is the vendor command
0xADover0x0D?Actually, the current value is incorrect. The correct value for the parameters of the vendor command is
0xAD.
Understood. You should have mentioned in the commit message of v2, and maybe explain how that typo happened, and where that command is documented.
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
- Example log for a security chip.
Bluetooth: hci0: RTL: examining hci_ver=0c hci_rev=000a
lmp_ver=0c lmp_subver=8922Bluetooth: hci0: RTL:
rom_versionstatus=0 version=1
Bluetooth: hci0: RTL: loading rtl_bt/rtl8922au_fw.bin
Bluetooth: hci0: RTL:cfg_sz0, total sz 71301
Bluetooth: hci0: RTL: fw version0x41c0c905- Example log for a normal chip.
Bluetooth: hci0: RTL: examining hci_ver=0c hci_rev=000a
lmp_ver=0c lmp_subver=8922Bluetooth: hci0: RTL:
rom_versionstatus=0 version=1
Bluetooth: hci0: RTL: loading rtl_bt/rtl8922au_fw.bin
Bluetooth: hci0: RTL: loading rtl_bt/rtl8922au_config.bin
Bluetooth: hci0: RTL:cfg_sz6, total sz 71307
Bluetooth: hci0: RTL: fw version0x41c0c905
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Tested-by Hilda Wu <[email protected]>Signed-off-by Nial Ni <[email protected]>Signed-off-by Max Chou <[email protected]>--- drivers/bluetooth/btrtl.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
[…]
Kind regards,
Paul