[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-5f43086bb9224987010460dcf3dee68fbd4f574d@git.kernel.org>
Date: Tue, 18 Oct 2016 03:25:37 -0700
From: tip-bot for Peter Zijlstra <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: torvalds@...ux-foundation.org, jlayton@...chiereds.net,
bfields@...ldses.org, dvyukov@...gle.com, tglx@...utronix.de,
viro@...iv.linux.org.uk, linux-kernel@...r.kernel.org,
peterz@...radead.org, hpa@...or.com, mingo@...nel.org,
syzkaller@...glegroups.com
Subject: [tip:locking/urgent] locking, fs/locks: Add missing file_sem locks
Commit-ID: 5f43086bb9224987010460dcf3dee68fbd4f574d
Gitweb: http://git.kernel.org/tip/5f43086bb9224987010460dcf3dee68fbd4f574d
Author: Peter Zijlstra <peterz@...radead.org>
AuthorDate: Sat, 8 Oct 2016 10:12:28 +0200
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Tue, 18 Oct 2016 12:21:28 +0200
locking, fs/locks: Add missing file_sem locks
I overlooked a few code-paths that can lead to
locks_delete_global_locks().
Reported-by: Dmitry Vyukov <dvyukov@...gle.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Reviewed-by: Jeff Layton <jlayton@...chiereds.net>
Cc: Al Viro <viro@...iv.linux.org.uk>
Cc: Bruce Fields <bfields@...ldses.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: linux-fsdevel@...r.kernel.org
Cc: syzkaller <syzkaller@...glegroups.com>
Link: http://lkml.kernel.org/r/20161008081228.GF3142@twins.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
fs/locks.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/fs/locks.c b/fs/locks.c
index ce93b41..22c5b4a 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1609,6 +1609,7 @@ int fcntl_getlease(struct file *filp)
ctx = smp_load_acquire(&inode->i_flctx);
if (ctx && !list_empty_careful(&ctx->flc_lease)) {
+ percpu_down_read_preempt_disable(&file_rwsem);
spin_lock(&ctx->flc_lock);
time_out_leases(inode, &dispose);
list_for_each_entry(fl, &ctx->flc_lease, fl_list) {
@@ -1618,6 +1619,8 @@ int fcntl_getlease(struct file *filp)
break;
}
spin_unlock(&ctx->flc_lock);
+ percpu_up_read_preempt_enable(&file_rwsem);
+
locks_dispose_list(&dispose);
}
return type;
@@ -2529,11 +2532,14 @@ locks_remove_lease(struct file *filp, struct file_lock_context *ctx)
if (list_empty(&ctx->flc_lease))
return;
+ percpu_down_read_preempt_disable(&file_rwsem);
spin_lock(&ctx->flc_lock);
list_for_each_entry_safe(fl, tmp, &ctx->flc_lease, fl_list)
if (filp == fl->fl_file)
lease_modify(fl, F_UNLCK, &dispose);
spin_unlock(&ctx->flc_lock);
+ percpu_up_read_preempt_enable(&file_rwsem);
+
locks_dispose_list(&dispose);
}
Powered by blists - more mailing lists