* [PATCH] Bluetooth: MGMT: Fix Read Advertising Features hiding instances
@ 2026-11-26 16:19 Iaroslav Voitovych
2026-11-26 22:10 ` bluez.test.bot
0 siblings, 1 reply; 2+ messages in thread
From: Iaroslav Voitovych @ 2026-11-26 16:19 UTC (permalink / raw)
To: linux-bluetooth
Cc: Marcel Holtmann, Luiz Augusto von Dentz, Brian Gix, stable
read_adv_features() is meant to report instances 1 to
le_num_of_adv_sets and to leave out the mesh instance, which is
numbered le_num_of_adv_sets + 1. Instead it compares each instance
number with the number of instances, so an instance numbered above
the current number of instances is left out: with instances 1 and 2
added and instance 1 removed, for example after its timeout, instance
2 remains active but is no longer reported.
Compare with le_num_of_adv_sets, as the comment says.
This was found with mgmt-tester while writing tests for advertising
instances, and reproduced in QEMU with a new mgmt-tester case that adds
only instance 2: without this patch the reply lists no instance.
Fixes: b338d91703fa ("Bluetooth: Implement support for Mesh")
Cc: stable@vger.kernel.org
Signed-off-by: Iaroslav Voitovych <yaroslav.voytovych@gmail.com>
---
Tested in QEMU with a new mgmt-tester case, "Read Advertising
Features - Success 3 (Instance 2 only)", which is being submitted to
BlueZ separately. The case adds only instance 2 and expects exactly
that instance in the reply. It fails in 3 of 3 runs without this
patch and passes in 3 of 3 with it, on bluetooth-next f57f78086ab5
and 5063a0717aa2, v7.4-rc4, 7.3.6, 6.18.65, 6.12.119, 6.6.163 and
6.1.193.
No other case in the Bluetooth kernel CI's eleven testers changed its
result on any of these kernels; the CI itself runs only mgmt-tester
and mesh-tester for this file. No test has a mesh instance present
during the read; it stays hidden because its number is
le_num_of_adv_sets + 1. l2cap-tester hangs on 6.18, 6.12 and 6.6, and
iso-tester on 6.12, the same way with and without this patch; the
cases after those hangs, run separately, give the same results with
and without it. The same KASAN and lockdep reports appear with and
without it on 6.1.193, and the same lockdep report on 6.12.119.
The bug also shows on real hardware: on a QCA9377 (USB 13d3:3503)
with Ubuntu's 7.0.0-43 kernel, Add Advertising for instance 2 alone
succeeds and the controller accepts LE Set Advertising Enable for it,
yet Read Advertising Features lists no instance. On the same hardware,
with this patch on Ubuntu's 7.0.0-44 kernel (whose mgmt.c is
unchanged from 7.0.0-43), it lists instance 2.
net/bluetooth/mgmt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index d21538634bc3..01969ab57339 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -9074,7 +9074,7 @@ static int read_adv_features(struct sock *sk, struct hci_dev *hdev,
instance = rp->instance;
list_for_each_entry(adv_instance, &hdev->adv_instances, list) {
/* Only instances 1-le_num_of_adv_sets are externally visible */
- if (adv_instance->instance <= hdev->adv_instance_cnt) {
+ if (adv_instance->instance <= hdev->le_num_of_adv_sets) {
*instance = adv_instance->instance;
instance++;
} else {
base-commit: 5063a0717aa238f5242bf6b4abb8ddc1741ce682
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: Bluetooth: MGMT: Fix Read Advertising Features hiding instances
2026-11-26 16:19 [PATCH] Bluetooth: MGMT: Fix Read Advertising Features hiding instances Iaroslav Voitovych
@ 2026-11-26 22:10 ` bluez.test.bot
0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2026-11-26 22:10 UTC (permalink / raw)
To: linux-bluetooth, yaroslav.voytovych
[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1223545/
---Test result---
Test Summary:
CheckPatch PASS 0.68 seconds
VerifyFixes PASS 0.10 seconds
VerifySignedoff PASS 0.10 seconds
GitLint PASS 0.28 seconds
SubjectPrefix PASS 0.09 seconds
BuildKernel PASS 31.03 seconds
CheckAllWarning PASS 35.30 seconds
CheckSparse PASS 37.14 seconds
BuildKernel32 PASS 31.23 seconds
CheckKernelLLVM PASS 34.85 seconds
TestRunnerSetup PASS 750.17 seconds
TestRunner_mgmt-tester PASS 88.85 seconds
TestRunner_mesh-tester PASS 4.46 seconds
IncrementalBuild PASS 28.46 seconds
https://github.com/bluez/bluetooth-next/pull/1233
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-26 22:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 16:19 [PATCH] Bluetooth: MGMT: Fix Read Advertising Features hiding instances Iaroslav Voitovych
2026-11-26 22:10 ` bluez.test.bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox