* [PATCH v4 1/2] Bluetooth: btintel: Zero version data before parsing TLVs
@ 2026-10-08 14:06 Kiran K
2026-10-08 14:06 ` [PATCH v4 2/2] Bluetooth: btintel: load unlocker.sfi to allow unsigned firmware Kiran K
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Kiran K @ 2026-10-08 14:06 UTC (permalink / raw)
To: linux-bluetooth; +Cc: chethan.tumkur.narayan, chandrashekar.devegowda, Kiran K
Firmware may omit optional TLVs, leaving their corresponding fields
unset in the caller-supplied struct intel_version_tlv. Since the
structure is typically stack-allocated and not cleared beforehand,
fields for which no TLV is received retain uninitialized stack
memory. This stale data can be logged via btintel_version_info_tlv()
and copied back to the caller, leaking kernel stack contents.
Clear the structure in btintel_read_version_tlv() before parsing so
that fields with no corresponding TLV are deterministically zero
instead of containing garbage.
Fixes: 57375beef71a ("Bluetooth: btintel: Add infrastructure to read controller information")
Signed-off-by: Kiran K <kiran.k@intel.com>
---
drivers/bluetooth/btintel.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
index f298c91f4f4e..c4a6b5ea64f1 100644
--- a/drivers/bluetooth/btintel.c
+++ b/drivers/bluetooth/btintel.c
@@ -752,6 +752,7 @@ static int btintel_read_version_tlv(struct hci_dev *hdev,
return -EIO;
}
+ memset(version, 0, sizeof(*version));
err = btintel_parse_version_tlv(hdev, version, skb);
kfree_skb(skb);
--
2.54.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v4 2/2] Bluetooth: btintel: load unlocker.sfi to allow unsigned firmware
2026-10-08 14:06 [PATCH v4 1/2] Bluetooth: btintel: Zero version data before parsing TLVs Kiran K
@ 2026-10-08 14:06 ` Kiran K
2026-10-08 15:26 ` [v4,1/2] Bluetooth: btintel: Zero version data before parsing TLVs bluez.test.bot
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Kiran K @ 2026-10-08 14:06 UTC (permalink / raw)
To: linux-bluetooth
Cc: chethan.tumkur.narayan, chandrashekar.devegowda, Kiran K,
Ravindra
When an unsigned operational firmware image is needed for debug, the
controller requires intel/unlocker.sfi to be loaded first. Without the
unlocker image, the controller rejects the unsigned operational firmware.
Support both firmware download flows based on the unlock policy advertised
in the version TLV:
BlazarI/BlazarIW/BlazarU/Gale Peak (unlock_policy == 0):
Boot ROM -> unlocker.sfi -> IML -> OPFW
Scorpius Peak onwards (unlock_policy == 1):
Boot ROM -> IML -> unlocker.sfi -> OPFW
Parse the new INTEL_TLV_UNLOCK_POLICY and INTEL_TLV_PLATFORM_ID TLVs
into struct intel_version_tlv, track the pending unlocker load through
a new btintel_data::unlocker flag, and pick intel/unlocker.sfi as the
firmware filename when that flag is set. If the unlocker image is not
present in the firmware search path, the driver silently falls through
to the normal firmware download path. If the unlocker image is present
but fails to download to the controller, the driver logs the error and
aborts bootloader setup, since continuing would leave the controller in
an inconsistent state.
[ 413.375247] Bluetooth: hci0: Found device firmware: intel/unlocker.sfi
[ 413.501051] Bluetooth: hci0: Waiting for firmware download to complete
[ 413.501058] Bluetooth: hci0: Firmware loaded in 122864 usecs
[ 413.501537] Bluetooth: hci0: Found device firmware: intel/ibt-02a2-01a1.sfi
[ 413.501547] Bluetooth: hci0: Boot Address: 0x10001000
[ 413.501548] Bluetooth: hci0: Firmware Version: 137-39.26
[ 414.103473] Bluetooth: hci0: Waiting for firmware download to complete
[ 414.103478] Bluetooth: hci0: Firmware loaded in 587841 usecs
[ 414.149576] Bluetooth: hci0: Applying Intel DDC parameters completed
[ 414.150089] Bluetooth: hci0: Firmware timestamp 2026.39 buildtype 3 build 86921
[ 414.150092] Bluetooth: hci0: Firmware SHA1: 0xeb2e0a4b
[ 414.150093] Bluetooth: hci0: Platform ID: 570c6ffbcbe6
[ 414.150094] Bluetooth: hci0: Fseq status: Success (0x00)
[ 414.150730] Bluetooth: hci0: Fseq executed: 15.255.00.98
[ 414.150734] Bluetooth: hci0: Fseq BT Top: 06.32.00.02
Assisted-by: Copilot:Claude Opus 4.7
Signed-off-by: Ravindra <ravindra@intel.com>
Signed-off-by: Kiran K <kiran.k@intel.com>
---
changes in v4:
In 1/2, addressed comment[1], comment[3]
https://sashiko.dev/#/patchset/20261007124721.2521956-1-kiran.k%40intel.com
changes in v3:
- Address Sashiko review comments
https://sashiko.dev/#/patchset/20260929021056.1396791-1-kiran.k%40intel.com
changes in v2:
- Updated commit message
drivers/bluetooth/btintel.c | 94 +++++++++++++++++++++++++++++++++++--
drivers/bluetooth/btintel.h | 5 ++
2 files changed, 96 insertions(+), 3 deletions(-)
diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
index c4a6b5ea64f1..0709fb3212f9 100644
--- a/drivers/bluetooth/btintel.c
+++ b/drivers/bluetooth/btintel.c
@@ -579,6 +579,11 @@ int btintel_version_info_tlv(struct hci_dev *hdev,
if (version->img_type == BTINTEL_IMG_OP)
bt_dev_info(hdev, "Firmware SHA1: 0x%8.8x", version->git_sha1);
+ if (!mem_is_zero(version->platform_id, sizeof(version->platform_id)))
+ bt_dev_info(hdev, "Platform ID: %6phN", version->platform_id);
+
+ bt_dev_info(hdev, "Unlock policy: 0x%2.2x", version->unlock_policy);
+
return 0;
}
EXPORT_SYMBOL_GPL(btintel_version_info_tlv);
@@ -604,11 +609,14 @@ static u8 btintel_version_tlv_min_len(u8 type)
case INTEL_TLV_DEBUG_LOCK:
case INTEL_TLV_LIMITED_CCE:
case INTEL_TLV_SBE_TYPE:
+ case INTEL_TLV_UNLOCK_POLICY:
return sizeof(u8);
case INTEL_TLV_MIN_FW:
return 3;
case INTEL_TLV_OTP_BDADDR:
return sizeof(bdaddr_t);
+ case INTEL_TLV_PLATFORM_ID:
+ return sizeof(((struct intel_version_tlv *)0)->platform_id);
default:
return 0;
}
@@ -716,6 +724,13 @@ int btintel_parse_version_tlv(struct hci_dev *hdev,
snprintf(version->fw_id, sizeof(version->fw_id),
"%.*s", tlv->len, tlv->val);
break;
+ case INTEL_TLV_UNLOCK_POLICY:
+ version->unlock_policy = tlv->val[0];
+ break;
+ case INTEL_TLV_PLATFORM_ID:
+ memcpy(version->platform_id, tlv->val,
+ sizeof(version->platform_id));
+ break;
default:
/* Ignore rest of information */
break;
@@ -2473,7 +2488,12 @@ static int btintel_prepare_fw_download_tlv(struct hci_dev *hdev,
else
btintel_get_fw_name_tlv(ver, fwname, sizeof(fwname), "sfi");
} else {
- btintel_get_fw_name_tlv(ver, fwname, sizeof(fwname), "sfi");
+ if (intel_data->unlocker) {
+ strscpy(fwname, "intel/unlocker.sfi");
+ intel_data->unlocker = false;
+ } else {
+ btintel_get_fw_name_tlv(ver, fwname, sizeof(fwname), "sfi");
+ }
}
err = firmware_request_nowarn(&fw, fwname, &hdev->dev);
@@ -3490,6 +3510,36 @@ static int btintel_set_specific_absorption_rate(struct hci_dev *hdev,
return 0;
}
+/* Attempt to load intel/unlocker.sfi if it is present in the firmware
+ * search path. If the file is not available the device will be booted
+ * with a signed operational firmware, which is the common case, so its
+ * absence must be treated as normal and not logged as an error.
+ */
+static int btintel_try_load_unlocker(struct hci_dev *hdev,
+ struct intel_version_tlv *ver)
+{
+ struct btintel_data *data = hci_get_priv(hdev);
+ const struct firmware *fw;
+ u32 boot_param = 0;
+ int err;
+
+ err = firmware_request_nowarn(&fw, "intel/unlocker.sfi", &hdev->dev);
+ if (err) {
+ bt_dev_dbg(hdev, "intel/unlocker.sfi not present (%d), skipping unlocker load",
+ err);
+ return 0;
+ }
+ release_firmware(fw);
+
+ data->unlocker = true;
+ err = btintel_prepare_fw_download_tlv(hdev, ver, &boot_param);
+ if (err) {
+ bt_dev_err(hdev, "Failed to load intel/unlocker.sfi (%d)", err);
+ data->unlocker = false;
+ }
+ return err;
+}
+
int btintel_bootloader_setup_tlv(struct hci_dev *hdev,
struct intel_version_tlv *ver)
{
@@ -3497,6 +3547,8 @@ int btintel_bootloader_setup_tlv(struct hci_dev *hdev,
char ddcname[64];
int err;
struct intel_version_tlv new_ver;
+ struct btintel_data *data = hci_get_priv(hdev);
+ u8 hw_variant = INTEL_HW_VARIANT(ver->cnvi_bt);
bt_dev_dbg(hdev, "");
@@ -3515,6 +3567,31 @@ int btintel_bootloader_setup_tlv(struct hci_dev *hdev,
btintel_set_flag(hdev, INTEL_BOOTLOADER);
+ data->unlocker = false;
+
+ /* Legacy unlocker flow (BlazarI / BlazarIW / BlazarU / Gale Peak):
+ * Boot ROM -> unlocker.sfi -> IML -> OPFW
+ *
+ * Skip the unlocker check when the controller is already running
+ * operational firmware (can happen on USB); the unlocker flow is
+ * only meaningful from the bootloader stage.
+ */
+ if (ver->img_type != BTINTEL_IMG_OP &&
+ ver->api_lock && ver->unlock_policy == 0) {
+ switch (hw_variant) {
+ case BTINTEL_HWID_BZRI:
+ case BTINTEL_HWID_BZRIW:
+ case BTINTEL_HWID_BZRU:
+ case BTINTEL_HWID_GAP:
+ err = btintel_try_load_unlocker(hdev, ver);
+ if (err)
+ return err;
+ break;
+ default:
+ break;
+ }
+ }
+
err = btintel_prepare_fw_download_tlv(hdev, ver, &boot_param);
if (err)
return err;
@@ -3538,8 +3615,19 @@ int btintel_bootloader_setup_tlv(struct hci_dev *hdev,
return err;
}
- /* If image type returned is BTINTEL_IMG_IML, then controller supports
- * intermediate loader image
+ /* New unlocker flow (Scorpius Peak onwards):
+ * Boot ROM -> IML -> unlocker.sfi -> OPFW
+ */
+ if (hw_variant >= BTINTEL_HWID_SCP &&
+ ver->api_lock && ver->unlock_policy == 1) {
+ err = btintel_try_load_unlocker(hdev, ver);
+ if (err)
+ return err;
+ }
+
+ /* Transition to Operational Firmware
+ * If image type returned is BTINTEL_IMG_IML, then controller supports
+ * intermediate loader image.
*/
if (ver->img_type == BTINTEL_IMG_IML) {
err = btintel_prepare_fw_download_tlv(hdev, ver, &boot_param);
diff --git a/drivers/bluetooth/btintel.h b/drivers/bluetooth/btintel.h
index ff7c1d623007..9526acf65959 100644
--- a/drivers/bluetooth/btintel.h
+++ b/drivers/bluetooth/btintel.h
@@ -43,6 +43,8 @@ enum {
INTEL_TLV_OTP_BDADDR,
INTEL_TLV_UNLOCKED_STATE,
INTEL_TLV_GIT_SHA1,
+ INTEL_TLV_UNLOCK_POLICY = 0x3c,
+ INTEL_TLV_PLATFORM_ID = 0x3d,
INTEL_TLV_FW_ID = 0x50
};
@@ -108,6 +110,8 @@ struct intel_version_tlv {
u32 git_sha1;
u8 fw_id[BTINTEL_FWID_MAXLEN];
bdaddr_t otp_bd_addr;
+ u8 unlock_policy;
+ u8 platform_id[6];
};
struct intel_version {
@@ -261,6 +265,7 @@ struct btintel_data {
DECLARE_BITMAP(flags, __INTEL_NUM_FLAGS);
int (*acpi_reset_method)(struct hci_dev *hdev);
u32 cnvi_bt;
+ bool unlocker;
};
#define btintel_set_flag(hdev, nr) \
--
2.54.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: [v4,1/2] Bluetooth: btintel: Zero version data before parsing TLVs
2026-10-08 14:06 [PATCH v4 1/2] Bluetooth: btintel: Zero version data before parsing TLVs Kiran K
2026-10-08 14:06 ` [PATCH v4 2/2] Bluetooth: btintel: load unlocker.sfi to allow unsigned firmware Kiran K
@ 2026-10-08 15:26 ` bluez.test.bot
2026-10-09 14:00 ` Luiz Augusto von Dentz
2026-10-09 19:50 ` [PATCH v4 1/2] " patchwork-bot+bluetooth
2026-10-09 20:00 ` patchwork-bot+bluetooth
3 siblings, 1 reply; 6+ messages in thread
From: bluez.test.bot @ 2026-10-08 15:26 UTC (permalink / raw)
To: linux-bluetooth, kiran.k
[-- Attachment #1: Type: text/plain, Size: 1305 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/series/1181659/
---Test result---
Test Summary:
CheckPatch PASS 1.76 seconds
VerifyFixes PASS 0.13 seconds
VerifySignedoff PASS 0.12 seconds
GitLint FAIL 0.67 seconds
SubjectPrefix PASS 0.24 seconds
BuildKernel PASS 30.00 seconds
CheckAllWarning PASS 34.53 seconds
CheckSparse PASS 37.04 seconds
BuildKernel32 PASS 29.78 seconds
CheckKernelLLVM PASS 35.80 seconds
TestRunnerSetup PASS 785.35 seconds
IncrementalBuild PASS 31.58 seconds
Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[v4,2/2] Bluetooth: btintel: load unlocker.sfi to allow unsigned firmware
35: B1 Line exceeds max length (82>80): "[ 414.150089] Bluetooth: hci0: Firmware timestamp 2026.39 buildtype 3 build 86921"
https://github.com/bluez/bluetooth-next/pull/888
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [v4,1/2] Bluetooth: btintel: Zero version data before parsing TLVs
2026-10-08 15:26 ` [v4,1/2] Bluetooth: btintel: Zero version data before parsing TLVs bluez.test.bot
@ 2026-10-09 14:00 ` Luiz Augusto von Dentz
0 siblings, 0 replies; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2026-10-09 14:00 UTC (permalink / raw)
To: linux-bluetooth; +Cc: kiran.k
Hi Kiran,
On Thu, Oct 8, 2026 at 11:36 AM <bluez.test.bot@gmail.com> wrote:
>
> 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/series/1181659/
>
> ---Test result---
>
> Test Summary:
> CheckPatch PASS 1.76 seconds
> VerifyFixes PASS 0.13 seconds
> VerifySignedoff PASS 0.12 seconds
> GitLint FAIL 0.67 seconds
> SubjectPrefix PASS 0.24 seconds
> BuildKernel PASS 30.00 seconds
> CheckAllWarning PASS 34.53 seconds
> CheckSparse PASS 37.04 seconds
> BuildKernel32 PASS 29.78 seconds
> CheckKernelLLVM PASS 35.80 seconds
> TestRunnerSetup PASS 785.35 seconds
> IncrementalBuild PASS 31.58 seconds
>
> Details
> ##############################
> Test: GitLint - FAIL
> Desc: Run gitlint
> Output:
> [v4,2/2] Bluetooth: btintel: load unlocker.sfi to allow unsigned firmware
>
> 35: B1 Line exceeds max length (82>80): "[ 414.150089] Bluetooth: hci0: Firmware timestamp 2026.39 buildtype 3 build 86921"
>
>
> https://github.com/bluez/bluetooth-next/pull/888
>
> ---
> Regards,
> Linux Bluetooth
Sashiko is flagging the following problems:
https://sashiko.dev/#/patchset/20261008140602.2623464-1-kiran.k%40intel.com
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v4 1/2] Bluetooth: btintel: Zero version data before parsing TLVs
2026-10-08 14:06 [PATCH v4 1/2] Bluetooth: btintel: Zero version data before parsing TLVs Kiran K
2026-10-08 14:06 ` [PATCH v4 2/2] Bluetooth: btintel: load unlocker.sfi to allow unsigned firmware Kiran K
2026-10-08 15:26 ` [v4,1/2] Bluetooth: btintel: Zero version data before parsing TLVs bluez.test.bot
@ 2026-10-09 19:50 ` patchwork-bot+bluetooth
2026-10-09 20:00 ` patchwork-bot+bluetooth
3 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+bluetooth @ 2026-10-09 19:50 UTC (permalink / raw)
To: Kiran K; +Cc: linux-bluetooth, chethan.tumkur.narayan, chandrashekar.devegowda
Hello:
This series was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Thu, 8 Oct 2026 19:36:01 +0530 you wrote:
> Firmware may omit optional TLVs, leaving their corresponding fields
> unset in the caller-supplied struct intel_version_tlv. Since the
> structure is typically stack-allocated and not cleared beforehand,
> fields for which no TLV is received retain uninitialized stack
> memory. This stale data can be logged via btintel_version_info_tlv()
> and copied back to the caller, leaking kernel stack contents.
>
> [...]
Here is the summary with links:
- [v4,1/2] Bluetooth: btintel: Zero version data before parsing TLVs
https://git.kernel.org/bluetooth/bluetooth-next/c/21c8238e1b1d
- [v4,2/2] Bluetooth: btintel: load unlocker.sfi to allow unsigned firmware
(no matching commit)
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] 6+ messages in thread
* Re: [PATCH v4 1/2] Bluetooth: btintel: Zero version data before parsing TLVs
2026-10-08 14:06 [PATCH v4 1/2] Bluetooth: btintel: Zero version data before parsing TLVs Kiran K
` (2 preceding siblings ...)
2026-10-09 19:50 ` [PATCH v4 1/2] " patchwork-bot+bluetooth
@ 2026-10-09 20:00 ` patchwork-bot+bluetooth
3 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+bluetooth @ 2026-10-09 20:00 UTC (permalink / raw)
To: Kiran K; +Cc: linux-bluetooth, chethan.tumkur.narayan, chandrashekar.devegowda
Hello:
This series was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Thu, 8 Oct 2026 19:36:01 +0530 you wrote:
> Firmware may omit optional TLVs, leaving their corresponding fields
> unset in the caller-supplied struct intel_version_tlv. Since the
> structure is typically stack-allocated and not cleared beforehand,
> fields for which no TLV is received retain uninitialized stack
> memory. This stale data can be logged via btintel_version_info_tlv()
> and copied back to the caller, leaking kernel stack contents.
>
> [...]
Here is the summary with links:
- [v4,1/2] Bluetooth: btintel: Zero version data before parsing TLVs
(no matching commit)
- [v4,2/2] Bluetooth: btintel: load unlocker.sfi to allow unsigned firmware
https://git.kernel.org/bluetooth/bluetooth-next/c/964430c03896
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] 6+ messages in thread
end of thread, other threads:[~2026-10-09 20:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-08 14:06 [PATCH v4 1/2] Bluetooth: btintel: Zero version data before parsing TLVs Kiran K
2026-10-08 14:06 ` [PATCH v4 2/2] Bluetooth: btintel: load unlocker.sfi to allow unsigned firmware Kiran K
2026-10-08 15:26 ` [v4,1/2] Bluetooth: btintel: Zero version data before parsing TLVs bluez.test.bot
2026-10-09 14:00 ` Luiz Augusto von Dentz
2026-10-09 19:50 ` [PATCH v4 1/2] " patchwork-bot+bluetooth
2026-10-09 20:00 ` 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