From 799ab03f594ed03d4cf5b3f93b0045060500a5bb Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Thu, 17 Dec 2020 11:36:02 -0800 Subject: [PATCH] hwsim: check pending_create_msg before replying In the NEW_RADIO callback hwsim was assuming that DBus had no yet replied to the Create() method. In some cases the NEW_RADIO event fires before the actual callback which will respond to DBus. This causes a crash in the create callback. --- tools/hwsim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/hwsim.c b/tools/hwsim.c index 641a6c6f..c17792bf 100644 --- a/tools/hwsim.c +++ b/tools/hwsim.c @@ -1579,7 +1579,7 @@ static void radio_manager_create_callback(struct l_genl_msg *msg, */ radio = l_queue_find(radio_info, radio_info_match_id, L_UINT_TO_PTR(pending_create_radio_id)); - if (radio) { + if (radio && pending_create_msg) { const char *path = radio_get_path(radio); reply = l_dbus_message_new_method_return(pending_create_msg);