mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yang Li <yang.li@amlogic.com>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Marcel Holtmann <marcel@holtmann.org>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: Prevent unintended pause by checking if advertising is active
Date: Thu, 19 Jun 2025 10:50:01 +0800	[thread overview]
Message-ID: <c486b2ca-9afe-4a7a-88b4-905061ffaa16@amlogic.com> (raw)
In-Reply-To: <CABBYNZJnakr4Yt8GUVurYkG0G3GJS9-zvZe2CO0LaxS3QZJBVQ@mail.gmail.com>

Hi Luiz,
> [ EXTERNAL EMAIL ]
>
> Hi Yang,
>
> On Mon, Jun 16, 2025 at 7:05 AM Yang Li via B4 Relay
> <devnull+yang.li.amlogic.com@kernel.org> wrote:
>> From: Yang Li <yang.li@amlogic.com>
>>
>> When PA Create Sync is enabled, advertising resumes unexpectedly.
>> Therefore, it's necessary to check whether advertising is currently
>> active before attempting to pause it.
>>
>>    < HCI Command: LE Add Device To... (0x08|0x0011) plen 7  #1345 [hci0] 48.306205
>>                  Address type: Random (0x01)
>>                  Address: 4F:84:84:5F:88:17 (Resolvable)
>>                  Identity type: Random (0x01)
>>                  Identity: FC:5B:8C:F7:5D:FB (Static)
>>    < HCI Command: LE Set Address Re.. (0x08|0x002d) plen 1  #1347 [hci0] 48.308023
>>                  Address resolution: Enabled (0x01)
>>    ...
>>    < HCI Command: LE Set Extended A.. (0x08|0x0039) plen 6  #1349 [hci0] 48.309650
>>                  Extended advertising: Enabled (0x01)
>>                  Number of sets: 1 (0x01)
>>                  Entry 0
>>                  Handle: 0x01
>>                  Duration: 0 ms (0x00)
>>                  Max ext adv events: 0
>>    ...
>>    < HCI Command: LE Periodic Adve.. (0x08|0x0044) plen 14  #1355 [hci0] 48.314575
>>                  Options: 0x0000
>>                  Use advertising SID, Advertiser Address Type and address
>>                  Reporting initially enabled
>>                  SID: 0x02
>>                  Adv address type: Random (0x01)
>>                  Adv address: 4F:84:84:5F:88:17 (Resolvable)
>>                  Identity type: Random (0x01)
>>                  Identity: FC:5B:8C:F7:5D:FB (Static)
>>                  Skip: 0x0000
>>                  Sync timeout: 20000 msec (0x07d0)
>>                  Sync CTE type: 0x0000
>>
>> Signed-off-by: Yang Li <yang.li@amlogic.com>
>> ---
>>   net/bluetooth/hci_sync.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
>> index 6687f2a4d1eb..4ea5a87f017d 100644
>> --- a/net/bluetooth/hci_sync.c
>> +++ b/net/bluetooth/hci_sync.c
>> @@ -2481,6 +2481,10 @@ static int hci_pause_advertising_sync(struct hci_dev *hdev)
>>          int err;
>>          int old_state;
>>
>> +       /* If controller is not advertising we are done. */
>> +       if (!hci_dev_test_flag(hdev, HCI_ADVERTISING))
>> +               return 0;
> HCI_ADVERTISING is for directed advertising, it shall probably be
> changed to HCI_LE_ADV like in hci_disable_advertising_sync.

Thanks for your valuable feedback.

I will do.

>>          /* If already been paused there is nothing to do. */
>>          if (hdev->advertising_paused)
>>                  return 0;
>>
>> ---
>> base-commit: 6c31dab4ff1e1f4e0f3412efb1cfc88033358d1f
>> change-id: 20250616-bluetooth_adv-6496e1ca6165
>>
>> Best regards,
>> --
>> Yang Li <yang.li@amlogic.com>
>>
>>
>
> --
> Luiz Augusto von Dentz

      reply	other threads:[~2025-06-19  2:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-16 11:05 Yang Li via B4 Relay
2025-06-18 13:06 ` Luiz Augusto von Dentz
2025-06-19  2:50   ` Yang Li [this message]

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=c486b2ca-9afe-4a7a-88b4-905061ffaa16@amlogic.com \
    --to=yang.li@amlogic.com \
    --cc=johan.hedberg@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

all inboxes | Powered by JetHome®