9p: fix mmap to be read-only
authorEric Van Hensbergen <ericvh@opteron.homeip.net>
Thu, 7 Feb 2008 01:25:05 +0000 (19:25 -0600)
committerEric Van Hensbergen <ericvh@opteron.homeip.net>
Thu, 7 Feb 2008 01:25:05 +0000 (19:25 -0600)
v9fs was allowing writable mmap which could lead to kernel BUG() cases.
This sets the mmap function to generic_file_readonly_mmap which (correctly)
returns an error to applications which open mmap for writing.

Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
fs/9p/vfs_file.c

index ba4b1caa9c43a7491bcef73b8e4585057ea3c57f..a616fff8906d8e803c928981a8cb346f46db7d76 100644 (file)
@@ -184,7 +184,7 @@ static const struct file_operations v9fs_cached_file_operations = {
        .open = v9fs_file_open,
        .release = v9fs_dir_release,
        .lock = v9fs_file_lock,
-       .mmap = generic_file_mmap,
+       .mmap = generic_file_readonly_mmap,
 };
 
 const struct file_operations v9fs_file_operations = {
@@ -194,5 +194,5 @@ const struct file_operations v9fs_file_operations = {
        .open = v9fs_file_open,
        .release = v9fs_dir_release,
        .lock = v9fs_file_lock,
-       .mmap = generic_file_mmap,
+       .mmap = generic_file_readonly_mmap,
 };