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]
Date:	Fri, 11 Oct 2013 08:25:20 -0400
From:	Jeff Layton <jlayton@...hat.com>
To:	linux-fsdevel@...r.kernel.org
Cc:	linux-kernel@...r.kernel.org,
	nfs-ganesha-devel@...ts.sourceforge.net,
	samba-technical@...ts.samba.org
Subject: [RFC PATCH 3/5] locks: skip FL_FILP_PRIVATE locks on close unless we're closing the correct filp

If the request has FL_CLOSE set, then we know we're releasing locks in
response to a fd being closed. When iterating over locks, skip any
locks that have FL_FILP_PRIVATE set and that don't have the same fl_file
pointer.

Signed-off-by: Jeff Layton <jlayton@...hat.com>
---
 fs/locks.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/fs/locks.c b/fs/locks.c
index 086c3b4..7186b9a 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -135,6 +135,7 @@
 #define IS_POSIX(fl)	(fl->fl_flags & FL_POSIX)
 #define IS_FLOCK(fl)	(fl->fl_flags & FL_FLOCK)
 #define IS_LEASE(fl)	(fl->fl_flags & FL_LEASE)
+#define IS_PRIVATE(fl)	(fl->fl_flags & FL_FILP_PRIVATE)
 
 static bool lease_breaking(struct file_lock *fl)
 {
@@ -1009,6 +1010,14 @@ static int __posix_lock_file(struct inode *inode, struct file_lock *request, str
 
 	/* Process locks with this owner. */
 	while ((fl = *before) && posix_same_owner(request, fl)) {
+		/*
+		 * For fd-private locks, only release locks that are associated
+		 * with this filp.
+		 */
+		if ((request->fl_flags & FL_CLOSE) && IS_PRIVATE(fl) &&
+		     request->fl_file != fl->fl_file)
+			goto next_lock;
+
 		/* Detect adjacent or overlapping regions (if same lock type)
 		 */
 		if (request->fl_type == fl->fl_type) {
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists