51f0aa
From 3de93d194a5d27cabfe40ddf58aea36939498ba4 Mon Sep 17 00:00:00 2001
51f0aa
From: DJ Delorie <dj@redhat.com>
51f0aa
Date: Mon, 25 Sep 2017 19:43:09 -0400
51f0aa
Subject: nscd: Release read lock after resetting timeout.
51f0aa
51f0aa
	[BZ #22161]
51f0aa
	* nscd/netgroupcache.c (addinnetgrX): Release read lock after
51f0aa
	resetting timeout.
51f0aa
51f0aa
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
51f0aa
Reviewed-by: Andreas Schwab <schwab@suse.de>
51f0aa
51f0aa
A lock is held by mempool_allocate() when CACHEABLE is true; we
51f0aa
must release this lock if we exit early.
51f0aa
51f0aa
diff -rup a/nscd/netgroupcache.c b/nscd/netgroupcache.c
51f0aa
--- a/nscd/netgroupcache.c	2017-09-19 15:37:22.000000000 -0400
51f0aa
+++ b/nscd/netgroupcache.c	2017-09-20 16:33:54.982679050 -0400
51f0aa
@@ -586,6 +586,8 @@ addinnetgrX (struct database_dyn *db, in
51f0aa
       dh->timeout = timeout;
51f0aa
       dh->ttl = dataset->head.ttl;
51f0aa
       ++dh->nreloads;
51f0aa
+      if (cacheable)
51f0aa
+	pthread_rwlock_unlock (&db->lock);
51f0aa
       return timeout;
51f0aa
     }
51f0aa