From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH v5 3/4] Bluetooth: MGMT: Fix pending state of instances added without HCI traffic
Date: Tue, 6 Oct 2026 10:15:01 -0400 [thread overview]
Message-ID: <20261006141502.3789138-3-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20261006141502.3789138-1-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
When Add Advertising completes without HCI communication, e.g. when the
device is not powered or the instance is overridden by Global
Advertising, the instance is left marked as pending, so a subsequent
failure in add_adv_complete would remove it despite it having been
successfully added.
Fix this by clearing the pending state before completing the command.
Fixes: fffd38bca51c ("Bluetooth: mgmt/hci_core: multi-adv for add_advertising*()")
Assisted-by: OpenCode:claude-opus-5.5
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
net/bluetooth/mgmt.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 106b35c88c98..93872a5fc39c 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -9173,6 +9173,12 @@ static int add_advertising(struct sock *sk, struct hci_dev *hdev,
if (!hdev_is_powered(hdev) ||
adv_overridden_by_global(hdev, adv) ||
!schedule_instance) {
+ /* Instance has been accepted so it shall no longer be
+ * considered pending, otherwise a later failure in
+ * add_adv_complete would remove it.
+ */
+ adv->pending = false;
+
rp.instance = cp->instance;
err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_ADD_ADVERTISING,
MGMT_STATUS_SUCCESS, &rp, sizeof(rp));
--
2.55.0
next prev parent reply other threads:[~2026-10-06 14:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-06 14:14 [PATCH v5 1/4] Bluetooth: MGMT: Fix advertising instances with Global Advertising Luiz Augusto von Dentz
2026-10-06 14:15 ` [PATCH v5 2/4] Bluetooth: HCI: Fix tracking of instances sharing handle 0x00 Luiz Augusto von Dentz
2026-10-06 14:15 ` Luiz Augusto von Dentz [this message]
2026-10-06 14:15 ` [PATCH v5 4/4] Bluetooth: MGMT: Fix leaking instance on Add Extended Advertising Parameters Luiz Augusto von Dentz
2026-10-06 15:10 ` [PATCH v5 1/4] Bluetooth: MGMT: Fix advertising instances with Global Advertising patchwork-bot+bluetooth
2026-10-06 15:24 ` [v5,1/4] " bluez.test.bot
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=20261006141502.3789138-3-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox