From: Cen Zhang <zzzccc427@gmail.com>
To: marcel@holtmann.org, luiz.dentz@gmail.com
Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
baijiaju1990@gmail.com, jjzuming@gmail.com, zzzccc427@gmail.com
Subject: [PATCH v2 0/2] Bluetooth: Fix advertising instance accesses without hdev->lock
Date: Thu, 19 Nov 2026 08:32:44 +0800 [thread overview]
Message-ID: <pm-bluetooth-objects-candidate-0245-v14-e37270232af59a877004-0@gmail.com> (raw)
Snapshot advertising instance data under hdev->lock and keep instance
numbers, rather than list pointers, while waiting for controller commands
(patch 1). The resume and power-on walks use a 255-byte stack array in
list order, covering every nonzero u8 instance ID without an allocation
failure after the pause state has been consumed. Widen the timeout
conversion before converting to 10 ms units and clamp to U16_MAX.
Translate management instance numbers to controller handles in the
remaining periodic advertising, BIG creation and advertising set
transfer commands. For the shared handle 0, update the intended instance
after the command succeeds, since the completion has no instance number
(patch 2). The remove-set and random-address paths have already been
fixed in the current tree and keep those implementations.
The former patch 2, "Bluetooth: hci_core: Initialize advertising RPA work
only once", is already applied upstream and is not included again.
Validation: GCC modular and Clang built-in Bluetooth builds, including
Clang context analysis; every prefix of both revised series and their
combined tree build on bluetooth-next f42f5cae154b.
No new kernel runtime test was run; the quoted report is from the earlier
instrumented test kernel.
I used Codex (OpenAI) to help write these patches.
Cen Zhang (2):
Bluetooth: hci_sync: Fix remaining advertising instance UAFs
Bluetooth: hci_sync: Use controller handles for periodic advertising
net/bluetooth/hci_sync.c | 343 ++++++++++++++++++++++++++++++---------
net/bluetooth/mgmt.c | 34 +++-
2 files changed, 292 insertions(+), 85 deletions(-)
---
Changes in v2:
- Address the advertising snapshot allocation and timeout/handle concerns
raised by Sashiko:
https://netdev-ai.bots.linux.dev/sashiko/#/patchset/pm-bluetooth-objects-candidate-0245-v9-6b34bc036455ad3dd4ea-0%40gmail.com
- Use a 255-byte stack array in list order, and widen and clamp the duration
conversion.
- Add a separate periodic/BIG/transfer handle mapping fix; retain the
remove-set and random-address fixes already in next.
- Drop the former patch 2, Initialize advertising RPA work only once,
because it is already applied upstream.
- Rebase onto bluetooth-next f42f5cae154b; preserve the connection-work
shutdown changes.
Link to v1: https://lore.kernel.org/r/pm-bluetooth-objects-candidate-0245-v9-6b34bc036455ad3dd4ea-0@gmail.com
next reply other threads:[~2026-11-19 0:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 0:32 Cen Zhang [this message]
2026-11-19 0:32 ` [PATCH v2 1/2] Bluetooth: hci_sync: Fix remaining advertising instance UAFs Cen Zhang
2026-11-19 0:32 ` [PATCH v2 2/2] Bluetooth: hci_sync: Use controller handles for periodic advertising Cen Zhang
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=pm-bluetooth-objects-candidate-0245-v14-e37270232af59a877004-0@gmail.com \
--to=zzzccc427@gmail.com \
--cc=baijiaju1990@gmail.com \
--cc=jjzuming@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.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