Hello,

Prevent NULL dereference before sync_concurr_limit_signal() calls.

Missing check was causing NULL dereference in case where
manager_get_ldap_instance() failed. This typically happens when BIND
is processing LDAP updates during shutdown.

I noticed this crash during sanity testing 4.2 release...

Please review it ASAP so I can release 4.3.

How to reproduce the problem:
Run BIND manually from console:
$ named -4 -g -u named -m record -n 10
and press Ctrl+C "almost immediately".

Sometimes it shutdowns cleanly and sometimes you can see a crash:

Thank you for your time!

--
Petr^2 Spacek
From 388b8b36b719c34c7fd4e8aab98eefc9c3130181 Mon Sep 17 00:00:00 2001
From: Petr Spacek <pspa...@redhat.com>
Date: Wed, 9 Apr 2014 14:01:00 +0200
Subject: [PATCH] Prevent NULL dereference before sync_concurr_limit_signal()
 calls.

Missing check was causing NULL dereference in case where
manager_get_ldap_instance() failed. This typically happens when BIND
is processing LDAP updates during shutdown.

Signed-off-by: Petr Spacek <pspa...@redhat.com>
---
 NEWS              | 5 +++++
 src/ldap_helper.c | 9 ++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index e787e7f2d73e3e99d3d5c0d03b9ea92dff75b510..78843f2d036a7ab25c00924af91e63228aea0a8f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+4.3
+====
+[1] LDAP update processing was fixed to prevent BIND from crashing during
+    shutdown.
+
 4.2
 ====
 [1] Record parsing was fixed to prevent child-zone data corruption in cases
diff --git a/src/ldap_helper.c b/src/ldap_helper.c
index 678e9f8a52181a5c63c96d29da9b3e5ec3b1273d..a406561a450d1e3fb0a6efcf2f0a4dc5b7c16ddc 100644
--- a/src/ldap_helper.c
+++ b/src/ldap_helper.c
@@ -3913,7 +3913,8 @@ update_zone(isc_task_t *task, isc_event_t *event)
 	}
 
 cleanup:
-	sync_concurr_limit_signal(inst->sctx);
+	if (inst != NULL)
+		sync_concurr_limit_signal(inst->sctx);
 	if (result != ISC_R_SUCCESS)
 		log_error_r("update_zone (syncrepl) failed for '%s'. "
 			  "Zones can be outdated, run `rndc reload`",
@@ -3948,7 +3949,8 @@ update_config(isc_task_t *task, isc_event_t *event)
 	CHECK(ldap_parse_configentry(entry, inst));
 
 cleanup:
-	sync_concurr_limit_signal(inst->sctx);
+	if (inst != NULL)
+		sync_concurr_limit_signal(inst->sctx);
 	if (result != ISC_R_SUCCESS)
 		log_error_r("update_config (syncrepl) failed for '%s'. "
 			    "Configuration can be outdated, run `rndc reload`",
@@ -4200,7 +4202,8 @@ cleanup:
 			  pevent->dn, pevent->chgtype);
 	}
 
-	sync_concurr_limit_signal(inst->sctx);
+	if (inst != NULL)
+		sync_concurr_limit_signal(inst->sctx);
 	if (zone_ptr != NULL)
 		dns_zone_detach(&zone_ptr);
 	if (dns_name_dynamic(&name))
-- 
1.9.0

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to