Blame SOURCES/0100-sbus-check-connection-for-NULL-before-unregister-it.patch

bb7cd1
From 556eb1200a3754935f573ccffee87554bf9e9296 Mon Sep 17 00:00:00 2001
bb7cd1
From: Sumit Bose <sbose@redhat.com>
bb7cd1
Date: Mon, 10 Apr 2017 13:45:27 +0200
bb7cd1
Subject: [PATCH 100/101] sbus: check connection for NULL before unregister it
bb7cd1
MIME-Version: 1.0
bb7cd1
Content-Type: text/plain; charset=UTF-8
bb7cd1
Content-Transfer-Encoding: 8bit
bb7cd1
bb7cd1
There seem to be code paths where the data is a added to the hash before
bb7cd1
the connection is properly initialized, to avoid core dump during shut
bb7cd1
down we only call dbus_conection_unregister_object_path() if there is a
bb7cd1
connection.
bb7cd1
bb7cd1
Resolves:
bb7cd1
https://pagure.io/SSSD/sssd/issue/3367
bb7cd1
bb7cd1
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
bb7cd1
(cherry picked from commit 35186217d44d0138a1aedf7a4db72249b2c40e66)
bb7cd1
---
bb7cd1
 src/sbus/sssd_dbus_interface.c | 8 +++++++-
bb7cd1
 1 file changed, 7 insertions(+), 1 deletion(-)
bb7cd1
bb7cd1
diff --git a/src/sbus/sssd_dbus_interface.c b/src/sbus/sssd_dbus_interface.c
bb7cd1
index 1a11c6abcf23053e3b8c77f4d469d7c202a88eb8..c9007a4814e09e26fedaf605ca7313234d5ebf2c 100644
bb7cd1
--- a/src/sbus/sssd_dbus_interface.c
bb7cd1
+++ b/src/sbus/sssd_dbus_interface.c
bb7cd1
@@ -490,7 +490,13 @@ sbus_opath_hash_delete_cb(hash_entry_t *item,
bb7cd1
     conn = talloc_get_type(pvt, struct sbus_connection);
bb7cd1
     path = sbus_opath_get_base_path(NULL, item->key.str);
bb7cd1
 
bb7cd1
-    dbus_connection_unregister_object_path(conn->dbus.conn, path);
bb7cd1
+    /* There seem to be code paths where the data is added to the hash
bb7cd1
+     * before the connection is properly initialized, to avoid core dump
bb7cd1
+     * during shut down we only call dbus_connection_unregister_object_path()
bb7cd1
+     * if there is a connection. */
bb7cd1
+    if (conn->dbus.conn != NULL) {
bb7cd1
+        dbus_connection_unregister_object_path(conn->dbus.conn, path);
bb7cd1
+    }
bb7cd1
 }
bb7cd1
 
bb7cd1
 hash_table_t *
bb7cd1
-- 
bb7cd1
2.9.3
bb7cd1