Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH bluetooth] Bluetooth: hci_event: Requeue failed name resolutions
@ 2026-11-27 15:46 Dickson Wu via B4 Relay
  2026-11-27 22:45 ` bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Dickson Wu via B4 Relay @ 2026-11-27 15:46 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Luiz Augusto von Dentz, Marcel Holtmann, Johan Hedberg

From: Dickson Wu <dickson.wu@certik.com>

When a Remote Name Request fails, hci_check_pending_name() removes the
inquiry entry from the resolve list and changes its state to
NAME_NOT_KNOWN, but does not add it to the unknown list.

If an Extended Inquiry Result later supplies a complete name for the
same address, hci_inquiry_cache_update() treats the NAME_NOT_KNOWN
entry as linked and deletes it again. This corrupts the list in
hci_rx_work.

Add the entry to the unknown list after the failed resolution, so a
later result unlinks it exactly once.

Fixes: c3e7c0d90b14 ("Bluetooth: Set name_state to unknown when entry name is empty")
Cc: stable@vger.kernel.org
Signed-off-by: Dickson Wu <dickson.wu@certik.com>
---
Reproduced under UML with KASAN and a vhci controller, on bluetooth-next
f57f78086ab5 and on mainline 9437ee8b6cf6. The sequence is BR/EDR
discovery, an EIR without a complete name, Confirm Name with
name_known=0, the Remote Name Request failing with page timeout, then a
second EIR for the same address with a complete name. The second
inquiry was started with a raw HCI_Inquiry from uid 65534 with no
capabilities, which hci_sec_filter allows. Stock and with the patch
reverted fault in list_del() from hci_extended_inquiry_result_evt() in
hci_rx_work. With the patch the guest stays up with no warning. The
reproducer is available if it helps.

This was found and the fix prepared with AI coding tools (OpenAI Codex
agents, with review by Claude). I went over the analysis and the patch
before signing off.

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index a9b6a6ccaa03..c767e8d32217 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -2582,6 +2582,8 @@ static void hci_check_pending_name(struct hci_dev *hdev, struct hci_conn *conn,
 	list_del(&e->list);
 
 	e->name_state = name ? NAME_KNOWN : NAME_NOT_KNOWN;
+	if (!name)
+		list_add(&e->list, &discov->unknown);
 	mgmt_remote_name(hdev, bdaddr, ACL_LINK, 0x00, e->data.rssi,
 			 name, name_len);
 


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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 15:46 [PATCH bluetooth] Bluetooth: hci_event: Requeue failed name resolutions Dickson Wu via B4 Relay
2026-11-27 22:45 ` bluez.test.bot

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