[PATCH 11/11] Bluetooth: hci_core: Don't treat HCI_DRV_PKT/HCI_DIAG_PKT as unknown type

From: Zijun Hu

Date: Sat Jul 25 2026 - 04:59:22 EST


Both HCI_DRV_PKT and HCI_DIAG_PKT reach hci_rx_work(), and leverage
the default switch case to free them silently. Relying on the default
case is prone to mislead readers into thinking either that:

1) they never arrive at hci_rx_work(), and the function does not
handle them at all; or
2) they are unknown packet types, which normally fall into the
default switch case.

Fix by giving both their own switch cases that free them explicitly.

Signed-off-by: Zijun Hu <zijun.hu@xxxxxxxxxxxxxxxx>
---
Previous version:
https://lore.kernel.org/all/20260719-fix_hci_rx_work-v1-1-2d7fdeed3640@xxxxxxxxxxxxxxxx

Changes since previous version:
- Improve commit title and message.
---
net/bluetooth/hci_core.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 9d5adf882509..85f1b44fed9b 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -4051,16 +4051,24 @@ static void hci_rx_work(struct work_struct *work)
hci_scodata_packet(hdev, skb);
break;

case HCI_ISODATA_PKT:
BT_DBG("%s ISO data packet", hdev->name);
hci_isodata_packet(hdev, skb);
break;

+ case HCI_DRV_PKT:
+ kfree_skb(skb);
+ break;
+
+ case HCI_DIAG_PKT:
+ kfree_skb(skb);
+ break;
+
default:
kfree_skb(skb);
break;
}
}
}

static int hci_send_cmd_sync(struct hci_dev *hdev, struct sk_buff *skb)

--
2.34.1