Update to 3.4-final.
[linux-flexiantxendom0-3.2.10.git] / fs / binfmt_misc.c
index 1befe2e..613aa06 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/sched.h>
+#include <linux/magic.h>
 #include <linux/binfmts.h>
 #include <linux/slab.h>
 #include <linux/ctype.h>
@@ -149,8 +150,7 @@ static int load_misc_binary(struct linux_binprm *bprm, struct pt_regs *regs)
 
                /* if the binary is not readable than enforce mm->dumpable=0
                   regardless of the interpreter's permissions */
-               if (file_permission(bprm->file, MAY_READ))
-                       bprm->interp_flags |= BINPRM_FLAGS_ENFORCE_NONDUMP;
+               would_dump(bprm, bprm->file);
 
                allow_write_access(bprm->file);
                bprm->file = NULL;
@@ -522,7 +522,7 @@ static void kill_node(Node *e)
        write_unlock(&entries_lock);
 
        if (dentry) {
-               dentry->d_inode->i_nlink--;
+               drop_nlink(dentry->d_inode);
                d_drop(dentry);
                dput(dentry);
                simple_release_fs(&bm_mnt, &entry_count);
@@ -561,7 +561,7 @@ static ssize_t bm_entry_write(struct file *file, const char __user *buffer,
                        break;
                case 2: set_bit(Enabled, &e->flags);
                        break;
-               case 3: root = dget(file->f_path.mnt->mnt_sb->s_root);
+               case 3: root = dget(file->f_path.dentry->d_sb->s_root);
                        mutex_lock(&root->d_inode->i_mutex);
 
                        kill_node(e);
@@ -588,7 +588,7 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
        Node *e;
        struct inode *inode;
        struct dentry *root, *dentry;
-       struct super_block *sb = file->f_path.mnt->mnt_sb;
+       struct super_block *sb = file->f_path.dentry->d_sb;
        int err = 0;
 
        e = create_entry(buffer, count);
@@ -667,7 +667,7 @@ static ssize_t bm_status_write(struct file * file, const char __user * buffer,
        switch (res) {
                case 1: enabled = 0; break;
                case 2: enabled = 1; break;
-               case 3: root = dget(file->f_path.mnt->mnt_sb->s_root);
+               case 3: root = dget(file->f_path.dentry->d_sb->s_root);
                        mutex_lock(&root->d_inode->i_mutex);
 
                        while (!list_empty(&entries))
@@ -700,7 +700,7 @@ static int bm_fill_super(struct super_block * sb, void * data, int silent)
                [3] = {"register", &bm_register_operations, S_IWUSR},
                /* last one */ {""}
        };
-       int err = simple_fill_super(sb, 0x42494e4d, bm_files);
+       int err = simple_fill_super(sb, BINFMTFS_MAGIC, bm_files);
        if (!err)
                sb->s_op = &s_ops;
        return err;
@@ -727,11 +727,8 @@ static struct file_system_type bm_fs_type = {
 static int __init init_misc_binfmt(void)
 {
        int err = register_filesystem(&bm_fs_type);
-       if (!err) {
-               err = insert_binfmt(&misc_format);
-               if (err)
-                       unregister_filesystem(&bm_fs_type);
-       }
+       if (!err)
+               insert_binfmt(&misc_format);
        return err;
 }