Linux bluetooth development
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@codecoup.pl>
To: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] adapter: Fix accessing NULL adv_manager
Date: Fri, 20 Apr 2018 13:37:07 +0200	[thread overview]
Message-ID: <3639790.BHHmaqKJhx@ix> (raw)
In-Reply-To: <20180420110238.24490-1-szymon.janc@codecoup.pl>

On Friday, 20 April 2018 13:02:38 CEST Szymon Janc wrote:
> adv_manager might be NULL also if BR/EDR only mdoe is set in main.conf
> or if btd_adv_manager_new failed so checking for LE in supported
> settings is not enough. This also makes btd_adv_manager_refresh
> consistent with other adv_manager API regarding passing NULL manager
> as function parameter.
> ---
>  src/adapter.c     | 3 +--
>  src/advertising.c | 3 +++
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/adapter.c b/src/adapter.c
> index f91b04173..932b2a34d 100644
> --- a/src/adapter.c
> +++ b/src/adapter.c
> @@ -540,8 +540,7 @@ static void settings_changed(struct btd_adapter
> *adapter, uint32_t settings) g_dbus_emit_property_changed(dbus_conn,
> adapter->path,
>  					ADAPTER_INTERFACE, "Discoverable");
>  		store_adapter_info(adapter);
> -		if (adapter->supported_settings & MGMT_SETTING_LE)
> -			btd_adv_manager_refresh(adapter->adv_manager);
> +		btd_adv_manager_refresh(adapter->adv_manager);
>  	}
> 
>  	if (changed_mask & MGMT_SETTING_BONDABLE) {
> diff --git a/src/advertising.c b/src/advertising.c
> index b976562c4..0cb6eac3a 100644
> --- a/src/advertising.c
> +++ b/src/advertising.c
> @@ -1173,6 +1173,9 @@ void btd_adv_manager_destroy(struct btd_adv_manager
> *manager)
> 
>  void btd_adv_manager_refresh(struct btd_adv_manager *manager)
>  {
> +	if (!manager)
> +		return;
> +
>  	queue_foreach(manager->clients, (queue_foreach_func_t)refresh_adv,
>  									NULL);
>  }

Applied.

-- 
pozdrawiam
Szymon Janc



      reply	other threads:[~2018-04-20 11:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-20 11:02 [PATCH] adapter: Fix accessing NULL adv_manager Szymon Janc
2018-04-20 11:37 ` Szymon Janc [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=3639790.BHHmaqKJhx@ix \
    --to=szymon.janc@codecoup.pl \
    --cc=linux-bluetooth@vger.kernel.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