aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2016-07-05 17:32:30 -0400
committerAndreas Blaesius <skate4life@gmx.de>2017-05-17 19:25:37 +0200
commit4e4782520debc6a43c17625c42067c61b7f9a3f9 (patch)
tree161a668d3651704d985d8fac54d20af426e702fe
parentf7ec89378117b946671934c0f481e414a3b4e811 (diff)
downloadkernel_samsung_tuna-4e4782520debc6a43c17625c42067c61b7f9a3f9.tar.gz
kernel_samsung_tuna-4e4782520debc6a43c17625c42067c61b7f9a3f9.tar.bz2
kernel_samsung_tuna-4e4782520debc6a43c17625c42067c61b7f9a3f9.zip
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>
-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)