summaryrefslogtreecommitdiffstats
path: root/mm/nommu.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2014-03-10 14:54:15 +0100
committerJeff Layton <jlayton@redhat.com>2014-03-31 14:24:43 +0200
commitd7a06983a01a33605191c0766857b832ac32a2b6 (patch)
treed6a0f83579e0d7a20a235ddb568d935fe54b24fb /mm/nommu.c
parentlocks: require that flock->l_pid be set to 0 for file-private locks (diff)
downloadlinux-d7a06983a01a33605191c0766857b832ac32a2b6.tar.xz
linux-d7a06983a01a33605191c0766857b832ac32a2b6.zip
locks: fix locks_mandatory_locked to respect file-private locks
As Trond pointed out, you can currently deadlock yourself by setting a file-private lock on a file that requires mandatory locking and then trying to do I/O on it. Avoid this problem by plumbing some knowledge of file-private locks into the mandatory locking code. In order to do this, we must pass down information about the struct file that's being used to locks_verify_locked. Reported-by: Trond Myklebust <trond.myklebust@primarydata.com> Signed-off-by: Jeff Layton <jlayton@redhat.com> Acked-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'mm/nommu.c')
-rw-r--r--mm/nommu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/nommu.c b/mm/nommu.c
index 8740213b1647..a554e5a451cd 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -995,7 +995,7 @@ static int validate_mmap_request(struct file *file,
(file->f_mode & FMODE_WRITE))
return -EACCES;
- if (locks_verify_locked(file_inode(file)))
+ if (locks_verify_locked(file))
return -EAGAIN;
if (!(capabilities & BDI_CAP_MAP_DIRECT))