[PATCH] adapter: Fix accessing NULL adv_manager

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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);
 }
-- 
2.14.3

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux