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