[PATCH] device: Disconnect service when disabling device

Jukka Rissanen jukka.rissanen at linux.intel.com
Thu Jan 5 02:55:10 PST 2012


We should disconnect service instead of disconnecting network
when device is disabled. Otherwise service might still have
a pointer to network that is no longer valid.

Fixes BMC#24592
---
Hi,

this is version 2 of the patch. It changes the service variable
name to same as in other functions.

Cheers,
Jukka

 src/device.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/device.c b/src/device.c
index 6a34d40..2767347 100644
--- a/src/device.c
+++ b/src/device.c
@@ -306,8 +306,15 @@ int __connman_device_disable(struct connman_device *device)
 
 	clear_scan_trigger(device);
 
-	if (device->network)
-		connman_network_set_connected(device->network, FALSE);
+	if (device->network) {
+		struct connman_service *service =
+			__connman_service_lookup_from_network(device->network);
+
+		if (service != NULL)
+			__connman_service_disconnect(service);
+		else
+			connman_network_set_connected(device->network, FALSE);
+	}
 
 	err = device->driver->disable(device);
 	if (err == 0) {
-- 
1.7.1



More information about the connman mailing list