summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-08-29 09:00:01 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-09-22 20:48:20 -0400
commitc5aa1e554a20fb3542c62688ae46049c9225a965 (patch)
tree8dd6c11b16f9615bced5b43f3918f3e992466b80 /fs
parent156cacb1d0d36b0d0582d9e798e58e0044f516b3 (diff)
downloadblackbird-op-linux-c5aa1e554a20fb3542c62688ae46049c9225a965.tar.gz
blackbird-op-linux-c5aa1e554a20fb3542c62688ae46049c9225a965.zip
close the race in nlmsvc_free_block()
we need to grab mutex before the reference counter reaches 0 Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/lockd/svclock.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index fb1a2bedbe97..8d80c990dffd 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -289,7 +289,6 @@ static void nlmsvc_free_block(struct kref *kref)
dprintk("lockd: freeing block %p...\n", block);
/* Remove block from file's list of blocks */
- mutex_lock(&file->f_mutex);
list_del_init(&block->b_flist);
mutex_unlock(&file->f_mutex);
@@ -303,7 +302,7 @@ static void nlmsvc_free_block(struct kref *kref)
static void nlmsvc_release_block(struct nlm_block *block)
{
if (block != NULL)
- kref_put(&block->b_count, nlmsvc_free_block);
+ kref_put_mutex(&block->b_count, nlmsvc_free_block, &block->b_file->f_mutex);
}
/*
OpenPOWER on IntegriCloud