[PATCH BlueZ] adapter: Fix not removing a device when the adapter is down

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

 



It is a documented error that MGMT_UNPAIR_DEVICE should return an error
if the controller is not powered.

This error is being ignored, and if the user asks for a device to be removed
while the controller is powered down, the keys associated with that device
will still be in the kernel side.

The solution is to return the user an error when it is asked to remove a
device and the controller is not powered.
---
 src/adapter.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/adapter.c b/src/adapter.c
index beb50cd..3f39d82 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2097,6 +2097,9 @@ static DBusMessage *remove_device(DBusConnection *conn,
 	if (!list)
 		return btd_error_does_not_exist(msg);
 
+	if (!(adapter->current_settings & MGMT_SETTING_POWERED))
+		return btd_error_not_ready(msg);
+
 	device = list->data;
 
 	device_set_temporary(device, TRUE);
-- 
1.8.1.1

--
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