aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ecryptfs/file.c')
-rw-r--r--fs/ecryptfs/file.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index d3f95f941c4..a2a97cb614d 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -151,7 +151,15 @@ static const struct vm_operations_struct ecryptfs_file_vm_ops = {
static int ecryptfs_file_mmap(struct file *file, struct vm_area_struct *vma)
{
+ struct file *lower_file = ecryptfs_file_to_lower(file);
int rc;
+ /*
+ * 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;
rc = generic_file_mmap(file, vma);
if (!rc)