Skip to content

Commit

Permalink
service: Do complete state transition on disconnect with error code.
Browse files Browse the repository at this point in the history
Normally, connman_agent_report_error() will report -EINPROGRESS. In this
case we return early from service_indicate_state() and miss to call
__connman_notifier_disconnect(). By missing to call
__connman_notifier_disconnect() we end up in an inconsistent state
machine.

This was observed when wpa_supplicant reported a disconnect with
reason code 1 (blocked) and connman_agent_reported_error() return
-EINPROGRESS.

Reported and tested by Henrik Persson.
  • Loading branch information
igaw authored and LaakkonenJussi committed Mar 12, 2021
1 parent 6cf9c41 commit 6db7b97
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions connman/src/service.c
Expand Up @@ -7652,15 +7652,14 @@ static int service_indicate_state(struct connman_service *service)
service_retry_connect, service);
}

if (service->connect_reason == CONNMAN_SERVICE_CONNECT_REASON_USER &&
if (service->connect_reason == CONNMAN_SERVICE_CONNECT_REASON_USER) {
connman_agent_report_error(service, service->path,
error2string(service->error),
report_error_cb,
get_dbus_sender(service),
NULL) == -EINPROGRESS)
return 0;
error2string(service->error),
report_error_cb,
get_dbus_sender(service),
NULL);
}
service_complete(service);

break;
}

Expand Down

0 comments on commit 6db7b97

Please sign in to comment.