Re: [PATCH] Bluetooth: hci_sync: add conditional locking annotations
Pauli Virtanen <[email protected]> Sat, 01 Aug 2026 11:45:00 +0300
| Newsgroups | org.kernel.vger.linux-bluetooth |
|---|---|
| Message-ID | <[email protected]> |
Hi Luiz,
pe, 2026-07-31 kello 15:18 -0700, Nathan Chancellor kirjoitti:
> On Sat, Jul 25, 2026 at 01:02:36PM +0300, Pauli Virtanen wrote:
> > Add context analysis annotations to functions doing conditional locking=
,
> > to suppress analysis warnings.
> >=20
> > Fixes: a3ad01d51d4b ("Bluetooth: hci_sync: Fix advertising data UAFs")
> > Signed-off-by: Pauli Virtanen <[email protected]>
>=20
> Tested-by: Nathan Chancellor <[email protected]> # build
>=20
> It would be nice if this could be applied, as this breaks recent clang
> builds due to context analysis being on by default and -Werror enabled
> by default with many configurations now:
>=20
> https://github.com/ClangBuiltLinux/continuous-integration2/actions/runs=
/30660246388
Do you think the Clang build can be enabled on Bluez testbot?
My plan for this was:
- Copy https://github.com/pv/bluez-ci-image under github.com/bluez
- Replace "ghcr.io/pv/bluez-ci-image:latest"=C2=A0
-> "ghcr.io/bluez/bluez-ci-image:latest"
- It should rebuild the image via github actions (may need push=C2=A0
a commit / rerun the action after copy), which uploads it to
https://github.com/orgs/bluez/packages
- Adjust the image address in https://github.com/bluez/action-ci/pull/7
to ghcr.io/bluez/bluez-ci-image:latest and merge the change
- If there is some issue, the testbot can be rolled back by reverting
back to "FROM blueztestbot/bluez-build:latest"
Later, the image can be updated by just pushing commits to the bluez-
ci-image repository, easier than current process.
>=20
> > ---
> > net/bluetooth/hci_sync.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >=20
> > diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
> > index d5554fbf3129..f5545f270f09 100644
> > --- a/net/bluetooth/hci_sync.c
> > +++ b/net/bluetooth/hci_sync.c
> > @@ -1255,6 +1255,7 @@ hci_set_ext_adv_params_sync(struct hci_dev *hdev,=
u8 instance,
> > }
> > =20
> > static int hci_set_ext_adv_data_sync(struct hci_dev *hdev, u8 instance=
)
> > + __context_unsafe(/* conditional locking */)
> > {
> > DEFINE_FLEX(struct hci_cp_le_set_ext_adv_data, pdu, data, length,
> > HCI_MAX_EXT_AD_LENGTH);
> > @@ -1343,6 +1344,7 @@ int hci_update_adv_data_sync(struct hci_dev *hdev=
, u8 instance)
> > }
> > =20
> > int hci_setup_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance)
> > + __context_unsafe(/* conditional locking */)
> > {
> > struct hci_cp_le_set_ext_adv_params cp;
> > struct hci_rp_le_set_ext_adv_params rp;
> > @@ -1499,6 +1501,7 @@ int hci_setup_ext_adv_instance_sync(struct hci_de=
v *hdev, u8 instance)
> > }
> > =20
> > static int hci_set_ext_scan_rsp_data_sync(struct hci_dev *hdev, u8 ins=
tance)
> > + __context_unsafe(/* conditional locking */)
> > {
> > DEFINE_FLEX(struct hci_cp_le_set_ext_scan_rsp_data, pdu, data, length=
,
> > HCI_MAX_EXT_AD_LENGTH);
> > @@ -1552,6 +1555,7 @@ static int hci_set_ext_scan_rsp_data_sync(struct =
hci_dev *hdev, u8 instance)
> > }
> > =20
> > static int __hci_set_scan_rsp_data_sync(struct hci_dev *hdev, u8 insta=
nce)
> > + __context_unsafe(/* conditional locking */)
> > {
> > struct hci_cp_le_set_scan_rsp_data cp;
> > u8 len;
> > @@ -1693,6 +1697,7 @@ static int hci_set_per_adv_params_sync(struct hci=
_dev *hdev, u8 instance,
> > }
> > =20
> > static int hci_set_per_adv_data_sync(struct hci_dev *hdev, u8 instance=
)
> > + __context_unsafe(/* conditional locking */)
> > {
> > DEFINE_FLEX(struct hci_cp_le_set_per_adv_data, pdu, data, length,
> > HCI_MAX_PER_AD_LENGTH);
> > --=20
> > 2.55.0
> >=20
--=20
Pauli Virtanen