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