lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240116-flsplit-v1-7-c9d0f4370a5d@kernel.org>
Date: Tue, 16 Jan 2024 14:46:03 -0500
From: Jeff Layton <jlayton@...nel.org>
To: Christian Brauner <brauner@...nel.org>, 
 Alexander Viro <viro@...iv.linux.org.uk>, 
 Eric Van Hensbergen <ericvh@...nel.org>, 
 Latchesar Ionkov <lucho@...kov.net>, 
 Dominique Martinet <asmadeus@...ewreck.org>, 
 Christian Schoenebeck <linux_oss@...debyte.com>, 
 David Howells <dhowells@...hat.com>, Marc Dionne <marc.dionne@...istor.com>, 
 Xiubo Li <xiubli@...hat.com>, Ilya Dryomov <idryomov@...il.com>, 
 Alexander Aring <aahringo@...hat.com>, David Teigland <teigland@...hat.com>, 
 Miklos Szeredi <miklos@...redi.hu>, 
 Andreas Gruenbacher <agruenba@...hat.com>, 
 Trond Myklebust <trond.myklebust@...merspace.com>, 
 Anna Schumaker <anna@...nel.org>, Chuck Lever <chuck.lever@...cle.com>, 
 Neil Brown <neilb@...e.de>, Olga Kornievskaia <kolga@...app.com>, 
 Dai Ngo <Dai.Ngo@...cle.com>, Tom Talpey <tom@...pey.com>, 
 Jan Kara <jack@...e.cz>, Mark Fasheh <mark@...heh.com>, 
 Joel Becker <jlbec@...lplan.org>, Joseph Qi <joseph.qi@...ux.alibaba.com>, 
 Steve French <sfrench@...ba.org>, Paulo Alcantara <pc@...guebit.com>, 
 Ronnie Sahlberg <lsahlber@...hat.com>, 
 Shyam Prasad N <sprasad@...rosoft.com>, Namjae Jeon <linkinjeon@...nel.org>, 
 Sergey Senozhatsky <senozhatsky@...omium.org>, 
 Steven Rostedt <rostedt@...dmis.org>, 
 Masami Hiramatsu <mhiramat@...nel.org>, 
 Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Cc: linux-kernel@...r.kernel.org, v9fs@...ts.linux.dev, 
 linux-afs@...ts.infradead.org, ceph-devel@...r.kernel.org, 
 gfs2@...ts.linux.dev, linux-fsdevel@...r.kernel.org, 
 linux-nfs@...r.kernel.org, ocfs2-devel@...ts.linux.dev, 
 linux-cifs@...r.kernel.org, samba-technical@...ts.samba.org, 
 linux-trace-kernel@...r.kernel.org, Jeff Layton <jlayton@...nel.org>
Subject: [PATCH 07/20] filelock: make posix_same_owner take file_lock_core
 pointers

Change posix_same_owner to take struct file_lock_core pointers, and
convert the callers to pass those in.

Signed-off-by: Jeff Layton <jlayton@...nel.org>
---
 fs/locks.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index e09920cc9da2..0c47497eb1a4 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -597,9 +597,9 @@ static inline int locks_overlap(struct file_lock *fl1, struct file_lock *fl2)
 /*
  * Check whether two locks have the same owner.
  */
-static int posix_same_owner(struct file_lock *fl1, struct file_lock *fl2)
+static int posix_same_owner(struct file_lock_core *fl1, struct file_lock_core *fl2)
 {
-	return fl1->fl_core.fl_owner == fl2->fl_core.fl_owner;
+	return fl1->fl_owner == fl2->fl_owner;
 }
 
 /* Must be called with the flc_lock held! */
@@ -864,7 +864,7 @@ static bool posix_locks_conflict(struct file_lock *caller_fl,
 	/* POSIX locks owned by the same process do not conflict with
 	 * each other.
 	 */
-	if (posix_same_owner(caller_fl, sys_fl))
+	if (posix_same_owner(&caller_fl->fl_core, &sys_fl->fl_core))
 		return false;
 
 	/* Check whether they overlap */
@@ -882,7 +882,7 @@ static bool posix_test_locks_conflict(struct file_lock *caller_fl,
 {
 	/* F_UNLCK checks any locks on the same fd. */
 	if (caller_fl->fl_core.fl_type == F_UNLCK) {
-		if (!posix_same_owner(caller_fl, sys_fl))
+		if (!posix_same_owner(&caller_fl->fl_core, &sys_fl->fl_core))
 			return false;
 		return locks_overlap(caller_fl, sys_fl);
 	}
@@ -985,7 +985,7 @@ static struct file_lock *what_owner_is_waiting_for(struct file_lock *block_fl)
 	struct file_lock *fl;
 
 	hash_for_each_possible(blocked_hash, fl, fl_core.fl_link, posix_owner_key(block_fl)) {
-		if (posix_same_owner(fl, block_fl)) {
+		if (posix_same_owner(&fl->fl_core, &block_fl->fl_core)) {
 			while (fl->fl_core.fl_blocker)
 				fl = fl->fl_core.fl_blocker;
 			return fl;
@@ -1012,7 +1012,7 @@ static int posix_locks_deadlock(struct file_lock *caller_fl,
 	while ((block_fl = what_owner_is_waiting_for(block_fl))) {
 		if (i++ > MAX_DEADLK_ITERATIONS)
 			return 0;
-		if (posix_same_owner(caller_fl, block_fl))
+		if (posix_same_owner(&caller_fl->fl_core, &block_fl->fl_core))
 			return 1;
 	}
 	return 0;
@@ -1185,13 +1185,13 @@ static int posix_lock_inode(struct inode *inode, struct file_lock *request,
 
 	/* Find the first old lock with the same owner as the new lock */
 	list_for_each_entry(fl, &ctx->flc_posix, fl_core.fl_list) {
-		if (posix_same_owner(request, fl))
+		if (posix_same_owner(&request->fl_core, &fl->fl_core))
 			break;
 	}
 
 	/* Process locks with this owner. */
 	list_for_each_entry_safe_from(fl, tmp, &ctx->flc_posix, fl_core.fl_list) {
-		if (!posix_same_owner(request, fl))
+		if (!posix_same_owner(&request->fl_core, &fl->fl_core))
 			break;
 
 		/* Detect adjacent or overlapping regions (if same lock type) */

-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ