mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-26 23:11:19 +01:00
asymcute: Fix deadlocks in REGACK, SUBACK and UNSUBACK handler
The handlers for these MQTT message lock the connection mutex on function entry. During automated testing of asymcute, I discovered return paths for these function which do not unlock the connection mutex. This results in a deadlock which prevents asymcute from sending any further messages.
This commit is contained in:
parent
fda230eb7c
commit
4dcb8edcc8
@ -415,6 +415,7 @@ static void _on_regack(asymcute_con_t *con, const uint8_t *data, size_t len)
|
||||
/* finish the registration by applying the topic id */
|
||||
asymcute_topic_t *topic = req->arg;
|
||||
if (topic == NULL) {
|
||||
mutex_unlock(&con->lock);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -497,6 +498,7 @@ static void _on_suback(asymcute_con_t *con, const uint8_t *data, size_t len)
|
||||
/* parse and apply assigned topic id */
|
||||
asymcute_sub_t *sub = req->arg;
|
||||
if (sub == NULL) {
|
||||
mutex_unlock(&con->lock);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -534,6 +536,7 @@ static void _on_unsuback(asymcute_con_t *con, const uint8_t *data, size_t len)
|
||||
/* remove subscription from list */
|
||||
asymcute_sub_t *sub = req->arg;
|
||||
if (sub == NULL) {
|
||||
mutex_unlock(&con->lock);
|
||||
return;
|
||||
} else if (con->subscriptions == sub) {
|
||||
con->subscriptions = sub->next;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user