From 4ad20787bbeb53559e96bdd74e06b8267a9d287b Mon Sep 17 00:00:00 2001 From: Tomas Korbar Date: Thu, 13 Mar 2025 12:31:14 +0100 Subject: [PATCH] dns: Fix invalid memory access on Dnsconfd DBUS error DBus errors were not properly handled after DBus calls and that caused SIGSEGV. Now they are checked. Fixes #1738 Fixes: b8714e86e4e7 ('dns: introduce configuration_serial support to the dnsconfd plugin') --- src/core/dns/nm-dns-dnsconfd.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/core/dns/nm-dns-dnsconfd.c b/src/core/dns/nm-dns-dnsconfd.c index 63b3060f3d..c994ec8bc9 100644 --- a/src/core/dns/nm-dns-dnsconfd.c +++ b/src/core/dns/nm-dns-dnsconfd.c @@ -132,6 +132,13 @@ dnsconfd_serial_retrieval_done(GObject *source_object, GAsyncResult *res, gpoint self = user_data; priv = NM_DNS_DNSCONFD_GET_PRIVATE(self); + if (!response) { + _LOGW("dnsconfd serial retrieval failed: %s", error->message); + priv->plugin_state = DNSCONFD_PLUGIN_IDLE; + _nm_dns_plugin_update_pending_maybe_changed(NM_DNS_PLUGIN(self)); + return; + } + nm_clear_g_cancellable(&priv->serial_cancellable); g_variant_get(response, "(v)", &new_serial_variant); @@ -201,8 +208,12 @@ dnsconfd_update_done(GObject *source_object, GAsyncResult *res, gpointer user_da nm_clear_g_cancellable(&priv->update_cancellable); - if (!response) + if (!response) { _LOGW("dnsconfd update failed: %s", error->message); + priv->plugin_state = DNSCONFD_PLUGIN_IDLE; + _nm_dns_plugin_update_pending_maybe_changed(NM_DNS_PLUGIN(self)); + return; + } /* By using &s we will get pointer to char data contained * in variant and thus no freing of dnsconfd_message is required */