about summary refs log tree commit diff
path: root/nscd/netgroupcache.c
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2017-09-25 19:43:09 -0400
committerDJ Delorie <dj@redhat.com>2017-09-25 19:49:36 -0400
commit3de93d194a5d27cabfe40ddf58aea36939498ba4 (patch)
tree6fbd102829448ed8091cc7788d89a9f11f71e801 /nscd/netgroupcache.c
parent5af1e931bfaf8ef28abd94c0c0ad14e4790cf429 (diff)
downloadglibc-3de93d194a5d27cabfe40ddf58aea36939498ba4.tar.gz
glibc-3de93d194a5d27cabfe40ddf58aea36939498ba4.tar.xz
glibc-3de93d194a5d27cabfe40ddf58aea36939498ba4.zip
nscd: Release read lock after resetting timeout.
	[BZ #22161]
	* nscd/netgroupcache.c (addinnetgrX): Release read lock after
	resetting timeout.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Reviewed-by: Andreas Schwab <schwab@suse.de>

A lock is held by mempool_allocate() when CACHEABLE is true; we
must release this lock if we exit early.
Diffstat (limited to 'nscd/netgroupcache.c')
-rw-r--r--nscd/netgroupcache.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c
index cd0c3ea19b..3ca96f8205 100644
--- a/nscd/netgroupcache.c
+++ b/nscd/netgroupcache.c
@@ -584,6 +584,8 @@ addinnetgrX (struct database_dyn *db, int fd, request_header *req,
       dh->timeout = timeout;
       dh->ttl = dataset->head.ttl;
       ++dh->nreloads;
+      if (cacheable)
+        pthread_rwlock_unlock (&db->lock);
       return timeout;
     }