From: Marcel Holtmann <marcel@holtmann.org>
To: Alain Michaud <alainm@chromium.org>
Cc: linux-bluetooth <linux-bluetooth@vger.kernel.org>, mcchou@chromium.org
Subject: Re: [PATCH] Bluetooth: Fix adv set removal processing.
Date: Mon, 15 Nov 2021 18:05:33 +0100 [thread overview]
Message-ID: <C44D0F6E-CF4F-44BC-BE13-43F62D083774@holtmann.org> (raw)
In-Reply-To: <20211115135114.2763223-1-alainm@chromium.org>
Hi Alain,
> When multiple advertisement sets are active and a single instance is
> removed, the processing of hci_cc_le_set_ext_adv_enable will result in
> considering all advertisements as disabled since the instance has
> already been removed from the list.
>
> The fix is to use the command parameters to validate the intent rather
> than making an assumption based on the validity of the adv set.
>
> remove_advertising() hci0
>
> hci_req_add_ev() hci0 opcode 0x2039 plen 6
> hci_req_add_ev() hci0 opcode 0x203c plen 1
>
> hci_remove_adv_instance() hci0 removing 2MR
> <-- This removes instance 2 from the adv_instances list
>
> hci_cc_le_set_ext_adv_enable() hci0 status 0x00
> hci_sent_cmd_data() hci0 opcode 0x2039
> hci_cc_le_set_ext_adv_enable() adv instance 0, enabled 0
> <-- This incorrectly assumes that all instances are
> being disabled while only handle 2 is being disabled.
>
> hci_cc_le_set_ext_adv_enable() adv instance list status - before
> hci_cc_le_set_ext_adv_enable() adv instance 3 is 1
> hci_cc_le_set_ext_adv_enable() adv instance 1 is 1
> hci_cc_le_set_ext_adv_enable() HCI_LE_ADV state before: 1
> hci_cc_le_set_ext_adv_enable() adv instance list status - after
> hci_cc_le_set_ext_adv_enable() adv instance 3 is 0
> hci_cc_le_set_ext_adv_enable() adv instance 1 is 0
> hci_cc_le_set_ext_adv_enable() HCI_LE_ADV state after: 0
> <-- This is incorrect since handle 1 and 3 are still enabled
> in the controller
>
> The fix was validated by running the ChromeOS bluetooth_AdapterAdvHealth
> test suite.
>
> Reviewed-by: mcchou@chromium.org
we need clear name and email in the tags please. And I also like to have Fixes: tags here as well.
> Signed-off-by: Alain Michaud <alainm@chromium.org>
>
> ---
>
> net/bluetooth/hci_event.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index d4b75a6cfeee..52161d04136f 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -1385,14 +1385,16 @@ static void hci_cc_le_set_ext_adv_enable(struct hci_dev *hdev,
> if (adv->enabled)
> goto unlock;
> }
> - } else {
> +
> + hci_dev_clear_flag(hdev, HCI_LE_ADV);
> + } else if (!cp->num_of_sets || !set->handle) {
> /* All instances shall be considered disabled */
> list_for_each_entry_safe(adv, n, &hdev->adv_instances,
> list)
> adv->enabled = false;
> - }
>
> - hci_dev_clear_flag(hdev, HCI_LE_ADV);
> + hci_dev_clear_flag(hdev, HCI_LE_ADV);
> + }
> }
Just checking if this wouldn’t be cleaner:
} else {
if (foo)
bar;
hci_dev_clear_flag(hdev, HCI_LE_ADV);
}
Regards
Marcel
next prev parent reply other threads:[~2021-11-15 17:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-15 13:51 [PATCH] Bluetooth: Fix adv set removal processing Alain Michaud
2021-11-15 17:05 ` Marcel Holtmann [this message]
2021-11-15 19:35 ` Luiz Augusto von Dentz
2021-11-16 20:49 ` Alain Michaud
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=C44D0F6E-CF4F-44BC-BE13-43F62D083774@holtmann.org \
--to=marcel@holtmann.org \
--cc=alainm@chromium.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=mcchou@chromium.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;
as well as URLs for NNTP newsgroup(s).