]> git.neil.brown.name Git - history.git/commitdiff
Very small patch to 0.99pl12 0.99.12-patch1
authorLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:09:12 +0000 (15:09 -0500)
committerLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:09:12 +0000 (15:09 -0500)
I hate to put out patches this soon after a release, but there is one
potentially major problem in pl12 which is very simple to fix..  I'm
including patches: both in plain ascii and as a uuencoded gzip file
(it's the same patch - the uuencoded one is in case there is any
newsserver that messes up whitespace).

The main patch is just the change from __get_free_page(GFP_BUFFER) into
get_free_page(GFP_KERNEL), and the two minor patches just add checks
that actually enforce the read-only nature of current file mmap'ings so
that any program that tries to do a write mapping at least will be told
that it won't work.

I'd suggest anybody compiling pl12 should add at least the file_table.c
patch: thanks to Alexandre Julliard for noticing this one.

            Linus

fs/file_table.c
fs/nfs/mmap.c
mm/mmap.c

index 8542dd90bbc1b98a826ea13c6f9753878a6b2318..df0ae4ae6033c3256f5b15043968423a5c7d33bc 100644 (file)
@@ -45,7 +45,7 @@ void grow_files(void)
        struct file * file;
        int i;
 
-       file = (struct file*) __get_free_page(GFP_BUFFER);
+       file = (struct file *) get_free_page(GFP_KERNEL);
 
        if (!file)
                return;
index e1b13fb1a0ebaf9e9d907ad8315b0e222d13ee11..24df306af76f3fb61019b93fbc2f0063e8ed5665 100644 (file)
@@ -50,6 +50,8 @@ int nfs_mmap(struct inode * inode, struct file * file,
 {
        struct vm_area_struct * mpnt;
 
+       if (prot & PAGE_RW)     /* only PAGE_COW or read-only supported now */
+               return -EINVAL;
        if (off & (inode->i_sb->s_blocksize - 1))
                return -EINVAL;
        if (len > high_memory || off > high_memory - len) /* avoid overflow */
index 60942beaf4c42053fe592133b90baa5696f247c8..cec3eb270f5fb8792d8f617eeec681916ec0154b 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -197,6 +197,8 @@ int generic_mmap(struct inode * inode, struct file * file,
        extern struct vm_operations_struct file_mmap;
        struct buffer_head * bh;
 
+       if (prot & PAGE_RW)     /* only PAGE_COW or read-only supported right now */
+               return -EINVAL;
        if (off & (inode->i_sb->s_blocksize - 1))
                return -EINVAL;
        if (len > high_memory || off > high_memory - len) /* avoid overflow */