[PATCH] Bluetooth: virtio_bt: Fix memory leak in virtbt_probe
[email protected] Wed, 29 Jul 2026 16:26:15 +0800
| Newsgroups | org.kernel.vger.linux-bluetooth |
|---|---|
| Message-ID | <[email protected]> |
From: Chen Zhang <[email protected]> In virtbt_probe, if virtio_find_vqs fails, it will return directly, causing a memory leak in vbt. Signed-off-by: Chen Zhang <[email protected]> --- drivers/bluetooth/virtio_bt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/bluetooth/virtio_bt.c b/drivers/bluetooth/virtio_bt.c index 140ab55c9fc5..5ca163f8ea70 100644 --- a/drivers/bluetooth/virtio_bt.c +++ b/drivers/bluetooth/virtio_bt.c @@ -311,7 +311,7 @@ static int virtbt_probe(struct virtio_device *vdev) err = virtio_find_vqs(vdev, VIRTBT_NUM_VQS, vbt->vqs, vqs_info, NULL); if (err) - return err; + goto alloc_vqs_failed; hdev = hci_alloc_dev(); if (!hdev) { @@ -400,6 +400,8 @@ static int virtbt_probe(struct virtio_device *vdev) hci_free_dev(hdev); failed: vdev->config->del_vqs(vdev); +alloc_vqs_failed: + kfree(vbt); return err; } -- 2.25.1