Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: btrtl: Don't leak return code when parsing firmware format v2
@ 2026-09-02 19:18 Rong Zhang
  2026-09-02 21:58 ` bluez.test.bot
  2026-09-03 20:00 ` [PATCH] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Rong Zhang @ 2026-09-02 19:18 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz, Alex Lu, Max Chou,
	Allen Chen
  Cc: Luiz Augusto von Dentz, linux-bluetooth, linux-kernel, stable,
	Rong Zhang

When key_id from chip is zero, rtlbt_parse_firmware_v2() intentionally
ignores all security headers. However, the implementation simply breaks
from a switch statement and leaks uninitialized return code `rc' (if the
first section is a security one) or the previous section's `rc'.

Fix it by really skipping a loop with `continue'. For consistency and
readability, also do the same for the default case.

Fixes: 9a24ce5e29b1 ("Bluetooth: btrtl: Firmware format v2 support")
Cc: stable@vger.kernel.org
Signed-off-by: Rong Zhang <i@rong.moe>
---
 drivers/bluetooth/btrtl.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index 03fa9409e3ee..d29813331603 100644
--- a/drivers/bluetooth/btrtl.c
+++ b/drivers/bluetooth/btrtl.c
@@ -591,7 +591,7 @@ static int rtlbt_parse_firmware_v2(struct hci_dev *hdev,
 			 * headers.
 			 */
 			if (!key_id)
-				break;
+				continue;
 			rc = btrtl_parse_section(hdev, btrtl_dev, opcode,
 						 ptr, section_len);
 			break;
@@ -600,8 +600,7 @@ static int rtlbt_parse_firmware_v2(struct hci_dev *hdev,
 						 ptr, section_len);
 			break;
 		default:
-			rc = 0;
-			break;
+			continue;
 		}
 		if (rc < 0) {
 			rtl_dev_err(hdev, "RTL: Parse section (%u) err %d",

---
base-commit: 786262be6048deab760f68c8acc2c85607165894
change-id: 0ec19dab-btrtl-fix-patch-sec-header-rc-leak-13534c2da4fd

Thanks,
Rong


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: Bluetooth: btrtl: Don't leak return code when parsing firmware format v2
  2026-09-02 19:18 [PATCH] Bluetooth: btrtl: Don't leak return code when parsing firmware format v2 Rong Zhang
@ 2026-09-02 21:58 ` bluez.test.bot
  2026-09-03 20:00 ` [PATCH] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2026-09-02 21:58 UTC (permalink / raw)
  To: linux-bluetooth, i

[-- Attachment #1: Type: text/plain, Size: 1181 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=1156419

---Test result---

Test Summary:
CheckPatch                    PASS      0.56 seconds
VerifyFixes                   PASS      7.11 seconds
VerifySignedoff               PASS      1.45 seconds
GitLint                       PASS      0.99 seconds
SubjectPrefix                 PASS      0.07 seconds
BuildKernel                   PASS      29.02 seconds
CheckAllWarning               PASS      31.61 seconds
CheckSparse                   PASS      30.12 seconds
BuildKernel32                 PASS      33.64 seconds
CheckKernelLLVM               SKIP      0.00 seconds
TestRunnerSetup               PASS      521.59 seconds
IncrementalBuild              PASS      26.81 seconds

Details
##############################
Test: CheckKernelLLVM - SKIP
Desc: Build kernel with LLVM + context analysis
Output:
Clang not found


https://github.com/bluez/bluetooth-next/pull/691

---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Bluetooth: btrtl: Don't leak return code when parsing firmware format v2
  2026-09-02 19:18 [PATCH] Bluetooth: btrtl: Don't leak return code when parsing firmware format v2 Rong Zhang
  2026-09-02 21:58 ` bluez.test.bot
@ 2026-09-03 20:00 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2026-09-03 20:00 UTC (permalink / raw)
  To: Rong Zhang
  Cc: marcel, luiz.dentz, alex_lu, max.chou, allen_chen, luiz.von.dentz,
	linux-bluetooth, linux-kernel, stable

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Thu, 03 Sep 2026 03:18:59 +0800 you wrote:
> When key_id from chip is zero, rtlbt_parse_firmware_v2() intentionally
> ignores all security headers. However, the implementation simply breaks
> from a switch statement and leaks uninitialized return code `rc' (if the
> first section is a security one) or the previous section's `rc'.
> 
> Fix it by really skipping a loop with `continue'. For consistency and
> readability, also do the same for the default case.
> 
> [...]

Here is the summary with links:
  - Bluetooth: btrtl: Don't leak return code when parsing firmware format v2
    https://git.kernel.org/bluetooth/bluetooth-next/c/0aab041d532f

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:[~2026-09-03 20:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-02 19:18 [PATCH] Bluetooth: btrtl: Don't leak return code when parsing firmware format v2 Rong Zhang
2026-09-02 21:58 ` bluez.test.bot
2026-09-03 20:00 ` [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