summaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs/file.c
diff options
context:
space:
mode:
authorTrond Myklebust2016-07-24 23:09:02 +0200
committerTrond Myklebust2016-07-24 23:09:02 +0200
commit1592c4d62a89bbca895c568d65ce290dfbc36ecc (patch)
tree6b979bc02ded2ea7e644c34e6939ffbbb7ee001d /fs/ecryptfs/file.c
parentMerge branch 'pnfs' (diff)
parentMerge tag 'nfs-rdma-4.8-2' of git://git.linux-nfs.org/projects/anna/nfs-rdma (diff)
downloadkernel-qcow2-linux-1592c4d62a89bbca895c568d65ce290dfbc36ecc.tar.gz
kernel-qcow2-linux-1592c4d62a89bbca895c568d65ce290dfbc36ecc.tar.xz
kernel-qcow2-linux-1592c4d62a89bbca895c568d65ce290dfbc36ecc.zip
Merge branch 'nfs-rdma'
Diffstat (limited to 'fs/ecryptfs/file.c')
-rw-r--r--fs/ecryptfs/file.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index 7000b96b783e..ca4e83750214 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -169,9 +169,22 @@ out:
return rc;
}
+static int ecryptfs_mmap(struct file *file, struct vm_area_struct *vma)
+{
+ struct file *lower_file = ecryptfs_file_to_lower(file);
+ /*
+ * Don't allow mmap on top of file systems that don't support it
+ * natively. If FILESYSTEM_MAX_STACK_DEPTH > 2 or ecryptfs
+ * allows recursive mounting, this will need to be extended.
+ */
+ if (!lower_file->f_op->mmap)
+ return -ENODEV;
+ return generic_file_mmap(file, vma);
+}
+
/**
* ecryptfs_open
- * @inode: inode speciying file to open
+ * @inode: inode specifying file to open
* @file: Structure to return filled in
*
* Opens the file specified by inode.
@@ -240,7 +253,7 @@ out:
/**
* ecryptfs_dir_open
- * @inode: inode speciying file to open
+ * @inode: inode specifying file to open
* @file: Structure to return filled in
*
* Opens the file specified by inode.
@@ -403,7 +416,7 @@ const struct file_operations ecryptfs_main_fops = {
#ifdef CONFIG_COMPAT
.compat_ioctl = ecryptfs_compat_ioctl,
#endif
- .mmap = generic_file_mmap,
+ .mmap = ecryptfs_mmap,
.open = ecryptfs_open,
.flush = ecryptfs_flush,
.release = ecryptfs_release,