3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 14:49:24 +01:00

adhoc: fix bogus Failed error and segfault on stop

The netdev_leave_adhoc() returns a negative errno on errors and zero
on success, but adhoc_dbus_stop() assumed the inverse when checking for
an error.

Also, the DBus message was not being referenced in adhoc->pending and
then adhoc_leave_cb() segfaulted attempting to dereference it.
This commit is contained in:
Diego Santa Cruz 2020-04-07 23:33:46 +02:00 committed by Denis Kenzior
parent 0b65fe3a95
commit d66dcc9412

View File

@ -576,9 +576,11 @@ static struct l_dbus_message *adhoc_dbus_stop(struct l_dbus *dbus,
if (!adhoc->started)
return l_dbus_message_new_method_return(message);
if (!netdev_leave_adhoc(adhoc->netdev, adhoc_leave_cb, adhoc))
if (netdev_leave_adhoc(adhoc->netdev, adhoc_leave_cb, adhoc))
return dbus_error_failed(message);
adhoc->pending = l_dbus_message_ref(message);
return NULL;
}