Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 0/2] Bluetooth: btrtl: Don't return NULL from btrtl_initialize()
@ 2026-11-15 19:53 Artur
  2026-11-15 19:53 ` [PATCH 1/2] Bluetooth: btrtl: Return an error when reading the key id fails Artur
  2026-11-15 19:53 ` [PATCH 2/2] Bluetooth: btrtl: Set an error code when skb allocation fails Artur
  0 siblings, 2 replies; 4+ messages in thread
From: Artur @ 2026-11-15 19:53 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz
  Cc: Max Chou, linux-bluetooth, linux-kernel, Artur

btrtl_initialize() has two error paths that jump to err_free while
'ret' is still 0, so the function returns ERR_PTR(0), which is NULL.
Both callers only check the result with IS_ERR() and then dereference
the pointer.

Patch 1 fixes the path taken when reading the RTL_SEC_PROJ register
fails. It can be hit by a controller that times out or answers the
vendor command with an error during setup.

Patch 2 fixes the path taken when allocating the skb for the drop
firmware vendor command fails.

The two bugs come from different commits, so they are fixed in
separate patches with their own Fixes: tags.

Testing: compile tested only, on x86_64 against mainline commit
fa2933aac170 (after v7.4-rc2), with W=1 and sparse, without new
warnings. smatch no longer reports "passing zero to 'ERR_PTR'" in
btrtl_initialize() after patch 2. The error paths have not been
exercised at runtime: no Realtek Bluetooth controller was available
and no reproducer was written. drivers/bluetooth/btrtl.c is identical
in bluetooth-next, so the series applies there as well.

The bugs were found with smatch while checking the Bluetooth USB
drivers. The analysis, the fixes and the descriptions were prepared
with the help of an AI coding assistant (Claude Opus 5.5).

Artur (2):
  Bluetooth: btrtl: Return an error when reading the key id fails
  Bluetooth: btrtl: Set an error code when skb allocation fails

 drivers/bluetooth/btrtl.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)


base-commit: fa2933aac170dd19c6a7f0d7b81a8f537e40915c
-- 
2.43.0


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

end of thread, other threads:[~2026-11-15 22:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-15 19:53 [PATCH 0/2] Bluetooth: btrtl: Don't return NULL from btrtl_initialize() Artur
2026-11-15 19:53 ` [PATCH 1/2] Bluetooth: btrtl: Return an error when reading the key id fails Artur
2026-11-15 22:44   ` Bluetooth: btrtl: Don't return NULL from btrtl_initialize() bluez.test.bot
2026-11-15 19:53 ` [PATCH 2/2] Bluetooth: btrtl: Set an error code when skb allocation fails Artur

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox