ARM: 6165/1: trap overflows on highmem pages from kmap_atomic when debugging
[safe/jmp/linux-2.6] / fs / anon_inodes.c
index 598237e..9bd4b38 100644 (file)
@@ -12,7 +12,6 @@
 #include <linux/file.h>
 #include <linux/poll.h>
 #include <linux/sched.h>
-#include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/fs.h>
 #include <linux/mount.h>
@@ -89,19 +88,11 @@ struct file *anon_inode_getfile(const char *name,
        struct qstr this;
        struct path path;
        struct file *file;
-       fmode_t mode;
        int error;
 
        if (IS_ERR(anon_inode_inode))
                return ERR_PTR(-ENODEV);
 
-       switch (flags & O_ACCMODE) {
-       case O_RDONLY: mode = FMODE_READ;               break;
-       case O_WRONLY: mode = FMODE_WRITE;              break;
-       case O_RDWR:   mode = FMODE_READ | FMODE_WRITE; break;
-       default:       return ERR_PTR(-EINVAL);
-       }
-
        if (fops->owner && !try_module_get(fops->owner))
                return ERR_PTR(-ENOENT);
 
@@ -129,7 +120,7 @@ struct file *anon_inode_getfile(const char *name,
        d_instantiate(path.dentry, anon_inode_inode);
 
        error = -ENFILE;
-       file = alloc_file(&path, mode, fops);
+       file = alloc_file(&path, OPEN_FMODE(flags), fops);
        if (!file)
                goto err_dput;
        file->f_mapping = anon_inode_inode->i_mapping;
@@ -214,9 +205,10 @@ static struct inode *anon_inode_mkinode(void)
         * that it already _is_ on the dirty list.
         */
        inode->i_state = I_DIRTY;
-       inode->i_mode = S_IRUSR | S_IWUSR;
+       inode->i_mode = S_IFREG | S_IRUSR | S_IWUSR;
        inode->i_uid = current_fsuid();
        inode->i_gid = current_fsgid();
+       inode->i_flags |= S_PRIVATE;
        inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
        return inode;
 }