From: Yun-Hao Chung <howardchung@xxxxxxxxxxxx> When |admin_policy_remove| is called, we set |devices| to NULL but never set it back until |admin_init|. This makes admin lost track of current registered device interface, so the next |admin_policy_removed| will not be able to unregister those interfaces. Reviewed-by: Archie Pusaka <apusaka@xxxxxxxxxxxx> --- tested with the following commands 0. device X is paired 1. rmmod btusb 2. modprobe btusb 3. [bluetoothctl] remove device X Verify |remove_device_data| is called by looking log. plugins/admin.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/admin.c b/plugins/admin.c index a8e7d2cd7898..0787e8381ed7 100644 --- a/plugins/admin.c +++ b/plugins/admin.c @@ -496,6 +496,9 @@ static int admin_policy_adapter_probe(struct btd_adapter *adapter) { const char *adapter_path; + if (!devices) + devices = queue_new(); + if (policy_data) { btd_warn(policy_data->adapter_id, "Policy data already exists"); @@ -623,7 +626,6 @@ static int admin_init(void) DBG(""); dbus_conn = btd_get_dbus_connection(); - devices = queue_new(); return btd_register_adapter_driver(&admin_policy_driver); } -- 2.34.0.rc1.387.gb447b232ab-goog