Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758654AbcJRJbv (ORCPT ); Tue, 18 Oct 2016 05:31:51 -0400 Received: from terminus.zytor.com ([198.137.202.10]:42812 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752193AbcJRJbl (ORCPT ); Tue, 18 Oct 2016 05:31:41 -0400 Date: Tue, 18 Oct 2016 02:31:03 -0700 From: tip-bot for Peter Zijlstra Message-ID: Cc: tglx@linutronix.de, dvyukov@google.com, peterz@infradead.org, torvalds@linux-foundation.org, jlayton@poochiereds.net, bfields@fieldses.org, linux-kernel@vger.kernel.org, mingo@kernel.org, hpa@zytor.com, syzkaller@googlegroups.com, viro@zeniv.linux.org.uk Reply-To: syzkaller@googlegroups.com, viro@zeniv.linux.org.uk, mingo@kernel.org, hpa@zytor.com, bfields@fieldses.org, jlayton@poochiereds.net, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, peterz@infradead.org, dvyukov@google.com, tglx@linutronix.de In-Reply-To: <20161008081228.GF3142@twins.programming.kicks-ass.net> References: <20161008081228.GF3142@twins.programming.kicks-ass.net> To: linux-tip-commits@vger.kernel.org Subject: [tip:locking/urgent] locking, fs/locks: Add missing file_sem locks Git-Commit-ID: 1c7df9c183278052aedc3dcb9fecb8bf2b24a659 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2184 Lines: 64 Commit-ID: 1c7df9c183278052aedc3dcb9fecb8bf2b24a659 Gitweb: http://git.kernel.org/tip/1c7df9c183278052aedc3dcb9fecb8bf2b24a659 Author: Peter Zijlstra AuthorDate: Sat, 8 Oct 2016 10:12:28 +0200 Committer: Ingo Molnar CommitDate: Tue, 18 Oct 2016 11:19:05 +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 Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Jeff Layton Cc: Al Viro Cc: Bruce Fields Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: linux-fsdevel@vger.kernel.org Cc: syzkaller Link: http://lkml.kernel.org/r/20161008081228.GF3142@twins.programming.kicks-ass.net Signed-off-by: Ingo Molnar --- 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); }