aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2016-07-05 17:32:30 -0400
committerAndreas Blaesius <skate4life@gmx.de>2017-03-17 11:02:52 +0100
commite46c80f76c1f23ee3d904202e2a5725a09b9a1de (patch)
tree911b435681323e45d4460e406b452fc6c9ad967e /fs
parent50821a944cf58e50039b0dc810e73b95cef986d8 (diff)
downloadkernel_samsung_espresso10-e46c80f76c1f23ee3d904202e2a5725a09b9a1de.zip
kernel_samsung_espresso10-e46c80f76c1f23ee3d904202e2a5725a09b9a1de.tar.gz
kernel_samsung_espresso10-e46c80f76c1f23ee3d904202e2a5725a09b9a1de.tar.bz2
ecryptfs: don't allow mmap when the lower fs doesn't support it
There are legitimate reasons to disallow mmap on certain files, notably in sysfs or procfs. We shouldn't emulate mmap support on file systems that don't offer support natively. CVE-2016-1583 Change-Id: I378990d848df48abfe4b58b08cc64e3563577474 Signed-off-by: Jeff Mahoney <jeffm@suse.com> Cc: stable@vger.kernel.org [tyhicks: clean up f_op check by using ecryptfs_file_to_lower()] Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Diffstat (limited to 'fs')
-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 d3f95f9..a2a97cb 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)