[PATCH 2/2] Bluetooth: virtio_bt: unregister hdev before freeing on open failure
Yi Cong <[email protected]>
| Newsgroups | org.kernel.vger.linux-bluetooth,org.kernel.vger.stable |
|---|---|
| Message-ID | <[email protected]> |
From: Yi Cong <[email protected]> When virtbt_open_vdev() fails after hci_register_dev() has succeeded, the 'open_failed' path frees the hdev without unregistering it first, leaving a dangling entry in the global HCI device list. Fixes: afd2daa26c7a ("Bluetooth: Add support for virtio transport driver") Cc: [email protected] Signed-off-by: Yi Cong <[email protected]> --- 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 b674fe0c2779e..7c9c3f0085dc0 100644 --- a/drivers/bluetooth/virtio_bt.c +++ b/drivers/bluetooth/virtio_bt.c @@ -401,6 +401,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.25.1