Check for task->path when removing an interface or a network
authorSamuel Ortiz <sameo@linux.intel.com>
Mon, 22 Mar 2010 12:10:13 +0000 (13:10 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 22 Mar 2010 16:56:34 +0000 (17:56 +0100)
We need to be more careful about task->path since it could disappear on
us if we want to go offline before we get the add_interface D-Bus reply.

plugins/supplicant.c

index ea71dba..bdb21cd 100644 (file)
@@ -509,6 +509,9 @@ static int remove_interface(struct supplicant_task *task)
 
        DBG("task %p", task);
 
+       if (task->path == NULL)
+               return 0;
+
 #if 0
        if (task->created == FALSE) {
                connman_device_set_powered(task->device, FALSE);
@@ -648,7 +651,7 @@ static int remove_network(struct supplicant_task *task)
 
        DBG("task %p", task);
 
-       if (task->netpath == NULL)
+       if (task->netpath == NULL || task->path == NULL)
                return -EINVAL;
 
        message = dbus_message_new_method_call(SUPPLICANT_NAME, task->path,
@@ -733,6 +736,9 @@ static int disconnect_network(struct supplicant_task *task)
 
        DBG("task %p", task);
 
+       if (task->path == NULL)
+               return -EINVAL;
+
        message = dbus_message_new_method_call(SUPPLICANT_NAME, task->path,
                                SUPPLICANT_INTF ".Interface", "disconnect");
        if (message == NULL)