All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yi Cong <cong.yi@linux.dev>
To: marcel@holtmann.org, luiz.dentz@gmail.com
Cc: linux-bluetooth@vger.kernel.org, stable@vger.kernel.org,
	Yi Cong <yicong@kylinos.cn>
Subject: [PATCH 2/2] Bluetooth: virtio_bt: unregister hdev before freeing on open failure
Date: Tue, 11 Aug 2026 11:27:02 +0800	[thread overview]
Message-ID: <20260811032702.67908-3-cong.yi@linux.dev> (raw)
In-Reply-To: <20260811032702.67908-1-cong.yi@linux.dev>

From: Yi Cong <yicong@kylinos.cn>

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: stable@vger.kernel.org
Signed-off-by: Yi Cong <yicong@kylinos.cn>
---
 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


      parent reply	other threads:[~2026-08-11  3:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-11  3:27 [PATCH 0/2] Bluetooth: virtio_bt: harden probe error paths Yi Cong
2026-08-11  3:27 ` [PATCH 1/2] Bluetooth: virtio_bt: fix leak of vbt on virtio_find_vqs failure Yi Cong
2026-08-11  4:45   ` Bluetooth: virtio_bt: harden probe error paths bluez.test.bot
2026-08-11  3:27 ` Yi Cong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260811032702.67908-3-cong.yi@linux.dev \
    --to=cong.yi@linux.dev \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=stable@vger.kernel.org \
    --cc=yicong@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.