From e2ee0e6a0dc2fc7f1b6acaf8675b577364711894 Mon Sep 17 00:00:00 2001 From: Ana Cabral Date: Tue, 25 Jan 2022 11:29:50 +0100 Subject: [PATCH] core/wwan: ensure correct conditions before signal emission Currently, ip4 new config signal is being emitted twice, due to the lack of a barrier to a possible situation. This commit includes this. This fixes a crash on NMCI tests due to an assertion failure, now it will not go ahead in the function anymore if it is under the undesired conditions. The backtrace of the crashes can be found at https://bugzilla.redhat.com/show_bug.cgi?id=2028385 --- src/core/devices/wwan/nm-device-modem.c | 5 ++++- src/core/devices/wwan/nm-modem.c | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core/devices/wwan/nm-device-modem.c b/src/core/devices/wwan/nm-device-modem.c index 80691bf97..4a0d9e443 100644 --- a/src/core/devices/wwan/nm-device-modem.c +++ b/src/core/devices/wwan/nm-device-modem.c @@ -170,7 +170,10 @@ modem_new_config(NMModem *modem, NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE(self); NMDevice *device = NM_DEVICE(self); - g_return_if_fail(nm_device_devip_get_state(device, addr_family) == NM_DEVICE_IP_STATE_PENDING); + if (nm_device_devip_get_state(device, addr_family) != NM_DEVICE_IP_STATE_PENDING) { + _LOGD(LOGD_MB, "retrieving IP configuration while no longer in pending state"); + return; + } if (error) { _LOGW(LOGD_MB, "retrieving IP configuration failed: %s", error->message); diff --git a/src/core/devices/wwan/nm-modem.c b/src/core/devices/wwan/nm-modem.c index 225eaa650..a5ee8ce8e 100644 --- a/src/core/devices/wwan/nm-modem.c +++ b/src/core/devices/wwan/nm-modem.c @@ -650,6 +650,10 @@ _ppp_mgr_callback(NMPppMgr *ppp_mgr, const NMPppMgrCallbackData *callback_data, * We will emit it together with stage3. */ continue; } + if (priv->ip_data_x[IS_IPv4].stage3_on_idle_source) { + /* We scheduled already a handler. Let it handle the new configuration. */ + continue; + } if (callback_data->data.ip_changed_x[IS_IPv4]) _ppp_maybe_emit_new_config(self, IS_IPv4 ? AF_INET : AF_INET6); }