[PATCH] fix: bluetooth: virtbt_probe: open_failed path calls hci_free_dev instead of hci_unregister_dev
From: WenTao Liang
Date: Fri Jun 26 2026 - 07:52:37 EST
When virtbt_open_vdev fails after hci_register_dev succeeds, the
open_failed error path calls hci_free_dev, which only releases the
allocation reference. The Bluetooth subsystem still holds a registration
reference and keeps the device on hci_dev_list. Fix by calling
hci_unregister_dev first, then hci_free_dev, matching the pattern in
virtbt_remove.
Cc: stable@xxxxxxxxxxxxxxx
Fixes: dc65b4b0f90a ("Bluetooth: virtio_bt: fix device removal")
Signed-off-by: WenTao Liang <vulab@xxxxxxxxxxx>
---
drivers/bluetooth/virtio_bt.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/bluetooth/virtio_bt.c b/drivers/bluetooth/virtio_bt.c
index 140ab55c9fc5..bf6827431bb8 100644
--- a/drivers/bluetooth/virtio_bt.c
+++ b/drivers/bluetooth/virtio_bt.c
@@ -397,6 +397,7 @@ static int virtbt_probe(struct virtio_device *vdev)
return 0;
open_failed:
+ hci_unregister_dev(hdev);
hci_free_dev(hdev);
failed:
vdev->config->del_vqs(vdev);
--
2.39.5 (Apple Git-154)