Linux bluetooth development
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Pauli Virtanen <pav@iki.fi>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: hci_sync: add conditional locking annotations
Date: Fri, 31 Jul 2026 15:18:40 -0700	[thread overview]
Message-ID: <20260731221840.GA4066390@ax162> (raw)
In-Reply-To: <528c354dca68f05cfd17df7c80f8b04419c0fb74.1784973709.git.pav@iki.fi>

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.
> 
> Fixes: a3ad01d51d4b ("Bluetooth: hci_sync: Fix advertising data UAFs")
> Signed-off-by: Pauli Virtanen <pav@iki.fi>

Tested-by: Nathan Chancellor <nathan@kernel.org> # build

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:

  https://github.com/ClangBuiltLinux/continuous-integration2/actions/runs/30660246388

> ---
>  net/bluetooth/hci_sync.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> 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,
>  }
>  
>  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)
>  }
>  
>  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_dev *hdev, u8 instance)
>  }
>  
>  static int hci_set_ext_scan_rsp_data_sync(struct hci_dev *hdev, u8 instance)
> +	__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)
>  }
>  
>  static int __hci_set_scan_rsp_data_sync(struct hci_dev *hdev, u8 instance)
> +	__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,
>  }
>  
>  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);
> -- 
> 2.55.0
> 

-- 
Cheers,
Nathan

  parent reply	other threads:[~2026-07-31 22:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-25 10:02 [PATCH] Bluetooth: hci_sync: add conditional locking annotations Pauli Virtanen
2026-07-25 10:50 ` bluez.test.bot
2026-07-31 22:18 ` Nathan Chancellor [this message]
2026-08-01  8:45   ` [PATCH] " Pauli Virtanen
2026-08-11 20:43   ` Nathan Chancellor

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=20260731221840.GA4066390@ax162 \
    --to=nathan@kernel.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=pav@iki.fi \
    /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