From: Jeff Mahoney Date: Tue, 5 Jul 2016 21:32:30 +0000 (-0400) Subject: ecryptfs: don't allow mmap when the lower fs doesn't support it X-Git-Tag: v4.1.12-92~41^2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=55a5161a5698db10ff75a2de66d8c8913788bb77;p=users%2Fjedix%2Flinux-maple.git 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 Signed-off-by: Jeff Mahoney Cc: stable@vger.kernel.org [tyhicks: clean up f_op check by using ecryptfs_file_to_lower()] Signed-off-by: Tyler Hicks Mainline v4.7 commit f0fe970df3838c202ef6c07a4c2b36838ef0a88b Replaces UEK4 commit e06914f2e9ac6b3f19d4461cb24b401f77ce4f17 which was reverted by UEK4 commit b1660e855b21. Orabug: 24971905 CVE: CVE-2016-1583 Signed-off-by: Chuck Anderson 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 @@ -365,7 +378,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,