git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
fs
/
binfmt_misc.c
diff --git
a/fs/binfmt_misc.c
b/fs/binfmt_misc.c
index
8ae0db6
..
c2e0825
100644
(file)
--- a/
fs/binfmt_misc.c
+++ b/
fs/binfmt_misc.c
@@
-55,6
+55,7
@@
typedef struct {
} Node;
static DEFINE_RWLOCK(entries_lock);
} Node;
static DEFINE_RWLOCK(entries_lock);
+static struct file_system_type bm_fs_type;
static struct vfsmount *bm_mnt;
static int entry_count;
static struct vfsmount *bm_mnt;
static int entry_count;
@@
-150,7
+151,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 the binary is not readable than enforce mm->dumpable=0
regardless of the interpreter's permissions */
- if (
permission(bprm->file->f_dentry->d_inode, MAY_READ, NULL
))
+ if (
file_permission(bprm->file, MAY_READ
))
bprm->interp_flags |= BINPRM_FLAGS_ENFORCE_NONDUMP;
allow_write_access(bprm->file);
bprm->interp_flags |= BINPRM_FLAGS_ENFORCE_NONDUMP;
allow_write_access(bprm->file);
@@
-203,7
+204,6
@@
static int load_misc_binary(struct linux_binprm *bprm, struct pt_regs *regs)
goto _error;
if (files) {
goto _error;
if (files) {
- steal_locks(files);
put_files_struct(files);
files = NULL;
}
put_files_struct(files);
files = NULL;
}
@@
-215,10
+215,8
@@
_error:
bprm->interp_flags = 0;
bprm->interp_data = 0;
_unshare:
bprm->interp_flags = 0;
bprm->interp_data = 0;
_unshare:
- if (files) {
- put_files_struct(current->files);
- current->files = files;
- }
+ if (files)
+ reset_files_struct(current, files);
goto _ret;
}
goto _ret;
}
@@
-264,7
+262,7
@@
static int unquote(char *from)
return p - from;
}
return p - from;
}
-static
inline
char * check_special_flags (char * sfs, Node * e)
+static char * check_special_flags (char * sfs, Node * e)
{
char * p = sfs;
int cont = 1;
{
char * p = sfs;
int cont = 1;
@@
-313,7
+311,7
@@
static Node *create_entry(const char __user *buffer, size_t count)
err = -ENOMEM;
memsize = sizeof(Node) + count + 8;
err = -ENOMEM;
memsize = sizeof(Node) + count + 8;
- e =
(Node *)
kmalloc(memsize, GFP_USER);
+ e = kmalloc(memsize, GFP_USER);
if (!e)
goto out;
if (!e)
goto out;
@@
-507,7
+505,6
@@
static struct inode *bm_get_inode(struct super_block *sb, int mode)
inode->i_mode = mode;
inode->i_uid = 0;
inode->i_gid = 0;
inode->i_mode = mode;
inode->i_uid = 0;
inode->i_gid = 0;
- inode->i_blksize = PAGE_CACHE_SIZE;
inode->i_blocks = 0;
inode->i_atime = inode->i_mtime = inode->i_ctime =
current_fs_time(inode->i_sb);
inode->i_blocks = 0;
inode->i_atime = inode->i_mtime = inode->i_ctime =
current_fs_time(inode->i_sb);
@@
-517,7
+514,7
@@
static struct inode *bm_get_inode(struct super_block *sb, int mode)
static void bm_clear_inode(struct inode *inode)
{
static void bm_clear_inode(struct inode *inode)
{
- kfree(inode->
u.generic_ip
);
+ kfree(inode->
i_private
);
}
static void kill_node(Node *e)
}
static void kill_node(Node *e)
@@
-545,7
+542,7
@@
static void kill_node(Node *e)
static ssize_t
bm_entry_read(struct file * file, char __user * buf, size_t nbytes, loff_t *ppos)
{
static ssize_t
bm_entry_read(struct file * file, char __user * buf, size_t nbytes, loff_t *ppos)
{
- Node *e = file->f_
dentry->d_inode->u.generic_ip
;
+ Node *e = file->f_
path.dentry->d_inode->i_private
;
loff_t pos = *ppos;
ssize_t res;
char *page;
loff_t pos = *ppos;
ssize_t res;
char *page;
@@
-579,7
+576,7
@@
static ssize_t bm_entry_write(struct file *file, const char __user *buffer,
size_t count, loff_t *ppos)
{
struct dentry *root;
size_t count, loff_t *ppos)
{
struct dentry *root;
- Node *e = file->f_
dentry->d_inode->u.generic_ip
;
+ Node *e = file->f_
path.dentry->d_inode->i_private
;
int res = parse_command(buffer, count);
switch (res) {
int res = parse_command(buffer, count);
switch (res) {
@@
-587,12
+584,12
@@
static ssize_t bm_entry_write(struct file *file, const char __user *buffer,
break;
case 2: set_bit(Enabled, &e->flags);
break;
break;
case 2: set_bit(Enabled, &e->flags);
break;
- case 3: root = dget(file->f_
vfs
mnt->mnt_sb->s_root);
-
down(&root->d_inode->i_sem
);
+ case 3: root = dget(file->f_
path.
mnt->mnt_sb->s_root);
+
mutex_lock(&root->d_inode->i_mutex
);
kill_node(e);
kill_node(e);
-
up(&root->d_inode->i_sem
);
+
mutex_unlock(&root->d_inode->i_mutex
);
dput(root);
break;
default: return res;
dput(root);
break;
default: return res;
@@
-600,7
+597,7
@@
static ssize_t bm_entry_write(struct file *file, const char __user *buffer,
return count;
}
return count;
}
-static struct file_operations bm_entry_operations = {
+static
const
struct file_operations bm_entry_operations = {
.read = bm_entry_read,
.write = bm_entry_write,
};
.read = bm_entry_read,
.write = bm_entry_write,
};
@@
-613,7
+610,7
@@
static ssize_t bm_register_write(struct file *file, const char __user *buffer,
Node *e;
struct inode *inode;
struct dentry *root, *dentry;
Node *e;
struct inode *inode;
struct dentry *root, *dentry;
- struct super_block *sb = file->f_
vfs
mnt->mnt_sb;
+ struct super_block *sb = file->f_
path.
mnt->mnt_sb;
int err = 0;
e = create_entry(buffer, count);
int err = 0;
e = create_entry(buffer, count);
@@
-622,7
+619,7
@@
static ssize_t bm_register_write(struct file *file, const char __user *buffer,
return PTR_ERR(e);
root = dget(sb->s_root);
return PTR_ERR(e);
root = dget(sb->s_root);
-
down(&root->d_inode->i_sem
);
+
mutex_lock(&root->d_inode->i_mutex
);
dentry = lookup_one_len(e->name, root, strlen(e->name));
err = PTR_ERR(dentry);
if (IS_ERR(dentry))
dentry = lookup_one_len(e->name, root, strlen(e->name));
err = PTR_ERR(dentry);
if (IS_ERR(dentry))
@@
-638,7
+635,7
@@
static ssize_t bm_register_write(struct file *file, const char __user *buffer,
if (!inode)
goto out2;
if (!inode)
goto out2;
- err = simple_pin_fs(
"binfmt_misc"
, &bm_mnt, &entry_count);
+ err = simple_pin_fs(
&bm_fs_type
, &bm_mnt, &entry_count);
if (err) {
iput(inode);
inode = NULL;
if (err) {
iput(inode);
inode = NULL;
@@
-646,7
+643,7
@@
static ssize_t bm_register_write(struct file *file, const char __user *buffer,
}
e->dentry = dget(dentry);
}
e->dentry = dget(dentry);
- inode->
u.generic_ip
= e;
+ inode->
i_private
= e;
inode->i_fop = &bm_entry_operations;
d_instantiate(dentry, inode);
inode->i_fop = &bm_entry_operations;
d_instantiate(dentry, inode);
@@
-658,7
+655,7
@@
static ssize_t bm_register_write(struct file *file, const char __user *buffer,
out2:
dput(dentry);
out:
out2:
dput(dentry);
out:
-
up(&root->d_inode->i_sem
);
+
mutex_unlock(&root->d_inode->i_mutex
);
dput(root);
if (err) {
dput(root);
if (err) {
@@
-668,7
+665,7
@@
out:
return count;
}
return count;
}
-static struct file_operations bm_register_operations = {
+static
const
struct file_operations bm_register_operations = {
.write = bm_register_write,
};
.write = bm_register_write,
};
@@
-702,20
+699,20
@@
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;
switch (res) {
case 1: enabled = 0; break;
case 2: enabled = 1; break;
- case 3: root = dget(file->f_
vfs
mnt->mnt_sb->s_root);
-
down(&root->d_inode->i_sem
);
+ case 3: root = dget(file->f_
path.
mnt->mnt_sb->s_root);
+
mutex_lock(&root->d_inode->i_mutex
);
while (!list_empty(&entries))
kill_node(list_entry(entries.next, Node, list));
while (!list_empty(&entries))
kill_node(list_entry(entries.next, Node, list));
-
up(&root->d_inode->i_sem
);
+
mutex_unlock(&root->d_inode->i_mutex
);
dput(root);
default: return res;
}
return count;
}
dput(root);
default: return res;
}
return count;
}
-static struct file_operations bm_status_operations = {
+static
const
struct file_operations bm_status_operations = {
.read = bm_status_read,
.write = bm_status_write,
};
.read = bm_status_read,
.write = bm_status_write,
};
@@
-740,10
+737,10
@@
static int bm_fill_super(struct super_block * sb, void * data, int silent)
return err;
}
return err;
}
-static
struct super_block *
bm_get_sb(struct file_system_type *fs_type,
- int flags, const char *dev_name, void *data)
+static
int
bm_get_sb(struct file_system_type *fs_type,
+ int flags, const char *dev_name, void *data
, struct vfsmount *mnt
)
{
{
- return get_sb_single(fs_type, flags, data, bm_fill_super);
+ return get_sb_single(fs_type, flags, data, bm_fill_super
, mnt
);
}
static struct linux_binfmt misc_format = {
}
static struct linux_binfmt misc_format = {