summaryrefslogtreecommitdiffstats
path: root/fs/locks.c
diff options
context:
space:
mode:
authorJeff Layton2015-02-17 23:08:23 +0100
committerJeff Layton2015-02-17 23:08:23 +0100
commit2e2f756f81edd7c3ba6ed384385ae1d6491652eb (patch)
treee68195e69bebc73b002f3354dc388c83d703a8f5 /fs/locks.c
parentlocks: remove conditional lock release in middle of flock_lock_file (diff)
downloadkernel-qcow2-linux-2e2f756f81edd7c3ba6ed384385ae1d6491652eb.tar.gz
kernel-qcow2-linux-2e2f756f81edd7c3ba6ed384385ae1d6491652eb.tar.xz
kernel-qcow2-linux-2e2f756f81edd7c3ba6ed384385ae1d6491652eb.zip
locks: fix list insertion when lock is split in two
In the case where we're splitting a lock in two, the current code the new "left" lock in the incorrect spot. It's inserted just before "right" when it should instead be inserted just before the new lock. When we add a new lock, set "fl" to that value so that we can add "left" before it. Reported-by: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Diffstat (limited to 'fs/locks.c')
-rw-r--r--fs/locks.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/locks.c b/fs/locks.c
index 90b652ad306f..365c82e1b3a9 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1107,6 +1107,7 @@ static int __posix_lock_file(struct inode *inode, struct file_lock *request, str
}
locks_copy_lock(new_fl, request);
locks_insert_lock_ctx(new_fl, &fl->fl_list);
+ fl = new_fl;
new_fl = NULL;
}
if (right) {