All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] adapter: Don't refresh adv_manager for non-LE devices
@ 2018-03-26 19:31 Antoine Belvire
  2018-03-27 11:00 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 3+ messages in thread
From: Antoine Belvire @ 2018-03-26 19:31 UTC (permalink / raw)
  To: linux-bluetooth

btd_adv_manager_refresh is called upon MGMT_SETTING_DISCOVERABLE setting change
but as only LE adapters have an adv_manager, this leads to segmentation fault
for non-LE devices:

0  btd_adv_manager_refresh (manager=0x0) at src/advertising.c:1176
1  0x0000556fe45fcb02 in settings_changed (settings=<optimized out>,
     adapter=0x556fe53f7c70) at src/adapter.c:543
2  new_settings_callback (index=<optimized out>, length=<optimized out>,
     param=<optimized out>, user_data=0x556fe53f7c70) at src/adapter.c:573
3  0x0000556fe462c278 in request_complete (mgmt=mgmt@entry=0x556fe53f20c0,
     status=<optimized out>, opcode=opcode@entry=7, index=index@entry=0,
     length=length@entry=4, param=0x556fe53eb5f9) at src/shared/mgmt.c:261
4  0x0000556fe462cd9d in can_read_data (io=<optimized out>,
     user_data=0x556fe53f20c0) at src/shared/mgmt.c:353
5  0x0000556fe46396e3 in watch_callback (channel=<optimized out>,
     cond=<optimized out>, user_data=<optimized out>)
     at src/shared/io-glib.c:170
6  0x00007fe351c980e5 in g_main_context_dispatch ()
    from /usr/lib64/libglib-2.0.so.0
7  0x00007fe351c984b0 in ?? () from /usr/lib64/libglib-2.0.so.0
8  0x00007fe351c987c2 in g_main_loop_run () from /usr/lib64/libglib-2.0.so.0
9  0x0000556fe45abc75 in main (argc=<optimized out>, argv=<optimized out>)
     at src/main.c:770

This commit prevents the call to btd_adv_manager_refresh for non-LE devices.
---
  src/adapter.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/adapter.c b/src/adapter.c
index 6d7d61504..e0f48cf9c 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -540,7 +540,8 @@ 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);
-		btd_adv_manager_refresh(adapter->adv_manager);
+		if (adapter->supported_settings & MGMT_SETTING_LE)
+			btd_adv_manager_refresh(adapter->adv_manager);
  	}

  	if (changed_mask & MGMT_SETTING_BONDABLE) {
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ] adapter: Don't refresh adv_manager for non-LE devices
  2018-03-26 19:31 [PATCH BlueZ] adapter: Don't refresh adv_manager for non-LE devices Antoine Belvire
@ 2018-03-27 11:00 ` Luiz Augusto von Dentz
  2018-03-27 18:29   ` Antoine Belvire
  0 siblings, 1 reply; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2018-03-27 11:00 UTC (permalink / raw)
  To: Antoine Belvire; +Cc: linux-bluetooth

Hi Antoine,

On Mon, Mar 26, 2018 at 10:31 PM, Antoine Belvire
<antoine.belvire@laposte.net> wrote:
> btd_adv_manager_refresh is called upon MGMT_SETTING_DISCOVERABLE setting
> change
> but as only LE adapters have an adv_manager, this leads to segmentation
> fault
> for non-LE devices:
>
> 0  btd_adv_manager_refresh (manager=0x0) at src/advertising.c:1176
> 1  0x0000556fe45fcb02 in settings_changed (settings=<optimized out>,
>     adapter=0x556fe53f7c70) at src/adapter.c:543
> 2  new_settings_callback (index=<optimized out>, length=<optimized out>,
>     param=<optimized out>, user_data=0x556fe53f7c70) at src/adapter.c:573
> 3  0x0000556fe462c278 in request_complete (mgmt=mgmt@entry=0x556fe53f20c0,
>     status=<optimized out>, opcode=opcode@entry=7, index=index@entry=0,
>     length=length@entry=4, param=0x556fe53eb5f9) at src/shared/mgmt.c:261
> 4  0x0000556fe462cd9d in can_read_data (io=<optimized out>,
>     user_data=0x556fe53f20c0) at src/shared/mgmt.c:353
> 5  0x0000556fe46396e3 in watch_callback (channel=<optimized out>,
>     cond=<optimized out>, user_data=<optimized out>)
>     at src/shared/io-glib.c:170
> 6  0x00007fe351c980e5 in g_main_context_dispatch ()
>    from /usr/lib64/libglib-2.0.so.0
> 7  0x00007fe351c984b0 in ?? () from /usr/lib64/libglib-2.0.so.0
> 8  0x00007fe351c987c2 in g_main_loop_run () from /usr/lib64/libglib-2.0.so.0
> 9  0x0000556fe45abc75 in main (argc=<optimized out>, argv=<optimized out>)
>     at src/main.c:770
>
> This commit prevents the call to btd_adv_manager_refresh for non-LE devices.
> ---
>  src/adapter.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/adapter.c b/src/adapter.c
> index 6d7d61504..e0f48cf9c 100644
> --- a/src/adapter.c
> +++ b/src/adapter.c
> @@ -540,7 +540,8 @@ 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);
> -               btd_adv_manager_refresh(adapter->adv_manager);
> +               if (adapter->supported_settings & MGMT_SETTING_LE)
> +                       btd_adv_manager_refresh(adapter->adv_manager);
>         }
>
>         if (changed_mask & MGMT_SETTING_BONDABLE) {
> --
> 2.16.2

This one doesn't apply anymore, could you please rebase.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ] adapter: Don't refresh adv_manager for non-LE devices
  2018-03-27 11:00 ` Luiz Augusto von Dentz
@ 2018-03-27 18:29   ` Antoine Belvire
  0 siblings, 0 replies; 3+ messages in thread
From: Antoine Belvire @ 2018-03-27 18:29 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,

Le 27/03/2018 à 13:00, Luiz Augusto von Dentz a écrit :
> This one doesn't apply anymore, could you please rebase.
Sorry, my email client trimmed a line :/ I resubmit a correct version asap.

--
Antoine

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-27 18:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-26 19:31 [PATCH BlueZ] adapter: Don't refresh adv_manager for non-LE devices Antoine Belvire
2018-03-27 11:00 ` Luiz Augusto von Dentz
2018-03-27 18:29   ` Antoine Belvire

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.