[bind-dyndb-ldap] Fix race condition in semaphore_wait (#727856)

Adam Tkac atkac at fedoraproject.org
Wed Aug 3 13:14:45 UTC 2011


commit ca3623992d11c6cbcf923f4707d8aca83463bdec
Author: Adam Tkac <atkac at redhat.com>
Date:   Wed Aug 3 15:14:01 2011 +0200

    Fix race condition in semaphore_wait (#727856)
    
    Signed-off-by: Adam Tkac <atkac at redhat.com>

 bind-dyndb-ldap-rh727856.patch |   15 +++++++++++++++
 bind-dyndb-ldap.spec           |    8 +++++++-
 2 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/bind-dyndb-ldap-rh727856.patch b/bind-dyndb-ldap-rh727856.patch
new file mode 100644
index 0000000..a536629
--- /dev/null
+++ b/bind-dyndb-ldap-rh727856.patch
@@ -0,0 +1,15 @@
+diff -up bind-dyndb-ldap-0.2.0/src/semaphore.c.rh727856 bind-dyndb-ldap-0.2.0/src/semaphore.c
+--- bind-dyndb-ldap-0.2.0/src/semaphore.c.rh727856	2011-08-02 18:03:49.034837252 +0200
++++ bind-dyndb-ldap-0.2.0/src/semaphore.c	2011-08-03 14:44:42.230665446 +0200
+@@ -83,9 +83,9 @@ semaphore_wait(semaphore_t *sem)
+ 
+ 	LOCK(&sem->mutex);
+ 
+-	sem->value--;
+-	if (sem->value < 0)
++	while (sem->value <= 0)
+ 		WAIT(&sem->cond, &sem->mutex);
++	sem->value--;
+ 
+ 	UNLOCK(&sem->mutex);
+ }
diff --git a/bind-dyndb-ldap.spec b/bind-dyndb-ldap.spec
index f456193..02a5da5 100644
--- a/bind-dyndb-ldap.spec
+++ b/bind-dyndb-ldap.spec
@@ -1,6 +1,6 @@
 Name:           bind-dyndb-ldap
 Version:        0.2.0
-Release:        3%{?dist}
+Release:        4%{?dist}
 Summary:        LDAP back-end plug-in for BIND
 
 Group:          System Environment/Libraries
@@ -15,6 +15,8 @@ BuildRequires:  openldap-devel
 
 Requires:       bind >= 32:9.6.1-0.3.b1
 
+Patch0:bind-dyndb-ldap-rh727856.patch
+
 %description
 This package provides an LDAP back-end plug-in for BIND. It features
 support for dynamic updates and internal caching, to lift the load
@@ -23,6 +25,7 @@ off of your LDAP server.
 
 %prep
 %setup -q
+%patch0 -p1 -b .rh727856
 
 %build
 export CFLAGS="`isc-config.sh --cflags dns` $RPM_OPT_FLAGS"
@@ -50,6 +53,9 @@ rm -rf %{buildroot}
 
 
 %changelog
+* Wed Aug 03 2011 Adam Tkac <atkac redhat com> - 0.2.0-4
+- fix race condition in semaphore_wait (#727856)
+
 * Mon Feb 21 2011 Adam Tkac <atkac redhat com> - 0.2.0-3
 - rebuild against new bind
 


More information about the scm-commits mailing list