Merge tag 'vfs-fix-ioctl-checking-3' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
[linux-2.6-microblaze.git] / fs / inode.c
index 446d05e..0f1e3b5 100644 (file)
@@ -362,7 +362,7 @@ EXPORT_SYMBOL(inc_nlink);
 
 static void __address_space_init_once(struct address_space *mapping)
 {
-       xa_init_flags(&mapping->i_pages, XA_FLAGS_LOCK_IRQ);
+       xa_init_flags(&mapping->i_pages, XA_FLAGS_LOCK_IRQ | XA_FLAGS_ACCOUNT);
        init_rwsem(&mapping->i_mmap_rwsem);
        INIT_LIST_HEAD(&mapping->private_list);
        spin_lock_init(&mapping->private_lock);
@@ -1899,6 +1899,26 @@ int file_update_time(struct file *file)
 }
 EXPORT_SYMBOL(file_update_time);
 
+/* Caller must hold the file's inode lock */
+int file_modified(struct file *file)
+{
+       int err;
+
+       /*
+        * Clear the security bits if the process is not being run by root.
+        * This keeps people from modifying setuid and setgid binaries.
+        */
+       err = file_remove_privs(file);
+       if (err)
+               return err;
+
+       if (unlikely(file->f_mode & FMODE_NOCMTIME))
+               return 0;
+
+       return file_update_time(file);
+}
+EXPORT_SYMBOL(file_modified);
+
 int inode_needs_sync(struct inode *inode)
 {
        if (IS_SYNC(inode))