From 02fc51f9637dad75b41c6adf5085074a456b7be0 Mon Sep 17 00:00:00 2001 From: Wen Liang Date: Thu, 3 Aug 2023 10:16:42 -0400 Subject: [PATCH] nm-policy: stop rechecking autoactivation if device is unregistered If the device is no longer registered to NMPolicy, `g_signal_handler_find()` can not find the signal handler that was disconnected before, therefore, there is no need to schedule a check for autoactivation. https://bugzilla.redhat.com/show_bug.cgi?id=2210271 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1711 --- src/core/nm-policy.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/core/nm-policy.c b/src/core/nm-policy.c index efdb06360f..024f76546c 100644 --- a/src/core/nm-policy.c +++ b/src/core/nm-policy.c @@ -1662,14 +1662,15 @@ nm_policy_device_recheck_auto_activate_schedule(NMPolicy *self, NMDevice *device g_return_if_fail(NM_IS_POLICY(self)); g_return_if_fail(NM_IS_DEVICE(device)); - nm_assert(g_signal_handler_find(device, - G_SIGNAL_MATCH_DATA, - 0, - 0, - NULL, - NULL, - NM_POLICY_GET_PRIVATE(self)) - != 0); + if (g_signal_handler_find(device, + G_SIGNAL_MATCH_DATA, + 0, + 0, + NULL, + NULL, + NM_POLICY_GET_PRIVATE(self)) + == 0) + return; if (!c_list_is_empty(&device->policy_auto_activate_lst)) { /* already queued. Return. */