X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-kernel.git;a=blobdiff_plain;f=fs%2Fecryptfs%2Ffile.c;h=298f5b2dad0879b48c446168adc5bc07f56d107d;hp=464fe1f177bb95932d46281ed5ebca4308cd54ce;hb=ef1b32244bb960a0b5243126042fe60ce58b4c91;hpb=b8c53651ee6cf3beb113e84c7f1d05d04a5815fb diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c index 464fe1f177bb..298f5b2dad08 100644 --- a/fs/ecryptfs/file.c +++ b/fs/ecryptfs/file.c @@ -183,6 +183,19 @@ 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 @@ -382,7 +395,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,