Blame SOURCES/0001-adapter-Don-t-refresh-adv_manager-for-non-LE-devices.patch

d15ffa
From 2c3bba7b38be03834162e34069156f1fd49f0528 Mon Sep 17 00:00:00 2001
d15ffa
From: "antoine.belvire@laposte.net" <antoine.belvire@laposte.net>
d15ffa
Date: Tue, 27 Mar 2018 20:30:26 +0200
d15ffa
Subject: [PATCH] adapter: Don't refresh adv_manager for non-LE devices
d15ffa
d15ffa
btd_adv_manager_refresh is called upon MGMT_SETTING_DISCOVERABLE setting change
d15ffa
but as only LE adapters have an adv_manager, this leads to segmentation fault
d15ffa
for non-LE devices:
d15ffa
d15ffa
0  btd_adv_manager_refresh (manager=0x0) at src/advertising.c:1176
d15ffa
1  0x0000556fe45fcb02 in settings_changed (settings=<optimized out>,
d15ffa
    adapter=0x556fe53f7c70) at src/adapter.c:543
d15ffa
2  new_settings_callback (index=<optimized out>, length=<optimized out>,
d15ffa
    param=<optimized out>, user_data=0x556fe53f7c70) at src/adapter.c:573
d15ffa
3  0x0000556fe462c278 in request_complete (mgmt=mgmt@entry=0x556fe53f20c0,
d15ffa
    status=<optimized out>, opcode=opcode@entry=7, index=index@entry=0,
d15ffa
    length=length@entry=4, param=0x556fe53eb5f9) at src/shared/mgmt.c:261
d15ffa
4  0x0000556fe462cd9d in can_read_data (io=<optimized out>,
d15ffa
    user_data=0x556fe53f20c0) at src/shared/mgmt.c:353
d15ffa
5  0x0000556fe46396e3 in watch_callback (channel=<optimized out>,
d15ffa
    cond=<optimized out>, user_data=<optimized out>)
d15ffa
    at src/shared/io-glib.c:170
d15ffa
6  0x00007fe351c980e5 in g_main_context_dispatch ()
d15ffa
   from /usr/lib64/libglib-2.0.so.0
d15ffa
7  0x00007fe351c984b0 in ?? () from /usr/lib64/libglib-2.0.so.0
d15ffa
8  0x00007fe351c987c2 in g_main_loop_run () from /usr/lib64/libglib-2.0.so.0
d15ffa
9  0x0000556fe45abc75 in main (argc=<optimized out>, argv=<optimized out>)
d15ffa
    at src/main.c:770
d15ffa
d15ffa
This commit prevents the call to btd_adv_manager_refresh for non-LE devices.
d15ffa
---
d15ffa
 src/adapter.c | 3 ++-
d15ffa
 1 file changed, 2 insertions(+), 1 deletion(-)
d15ffa
d15ffa
diff --git a/src/adapter.c b/src/adapter.c
d15ffa
index 6b9222bcf..daccfdc19 100644
d15ffa
--- a/src/adapter.c
d15ffa
+++ b/src/adapter.c
d15ffa
@@ -540,7 +540,8 @@ static void settings_changed(struct btd_adapter *adapter, uint32_t settings)
d15ffa
 		g_dbus_emit_property_changed(dbus_conn, adapter->path,
d15ffa
 					ADAPTER_INTERFACE, "Discoverable");
d15ffa
 		store_adapter_info(adapter);
d15ffa
-		btd_adv_manager_refresh(adapter->adv_manager);
d15ffa
+		if (adapter->supported_settings & MGMT_SETTING_LE)
d15ffa
+			btd_adv_manager_refresh(adapter->adv_manager);
d15ffa
 	}
d15ffa
 
d15ffa
 	if (changed_mask & MGMT_SETTING_BONDABLE) {
d15ffa
-- 
d15ffa
2.17.0
d15ffa