Commit f2567228 authored by Seth Forshee's avatar Seth Forshee Committed by Kamal Mostafa

Revert "UBUNTU: SAUCE: (namespace) mqueue: Super blocks must be owned by the...

Revert "UBUNTU: SAUCE: (namespace) mqueue: Super blocks must be owned by the user ns which owns the ipc ns"

BugLink: http://bugs.launchpad.net/bugs/1588056

This reverts commit dec77184.
Signed-off-by: default avatarSeth Forshee <seth.forshee@canonical.com>
Acked-by: default avatarTim Gardner <tim.gardner@canonical.com>
Acked-by: default avatarBrad Figg <brad.figg@canonical.com>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent 6ad37771
...@@ -951,14 +951,12 @@ static int ns_set_super(struct super_block *sb, void *data) ...@@ -951,14 +951,12 @@ static int ns_set_super(struct super_block *sb, void *data)
return set_anon_super(sb, NULL); return set_anon_super(sb, NULL);
} }
struct dentry *mount_ns_userns(struct file_system_type *fs_type, int flags, struct dentry *mount_ns(struct file_system_type *fs_type, int flags,
struct user_namespace *user_ns, void *data, void *data, int (*fill_super)(struct super_block *, void *, int))
int (*fill_super)(struct super_block *, void *, int))
{ {
struct super_block *sb; struct super_block *sb;
sb = sget_userns(fs_type, ns_test_super, ns_set_super, flags, user_ns, sb = sget(fs_type, ns_test_super, ns_set_super, flags, data);
data);
if (IS_ERR(sb)) if (IS_ERR(sb))
return ERR_CAST(sb); return ERR_CAST(sb);
...@@ -975,14 +973,6 @@ struct dentry *mount_ns_userns(struct file_system_type *fs_type, int flags, ...@@ -975,14 +973,6 @@ struct dentry *mount_ns_userns(struct file_system_type *fs_type, int flags,
return dget(sb->s_root); return dget(sb->s_root);
} }
EXPORT_SYMBOL(mount_ns_userns);
struct dentry *mount_ns(struct file_system_type *fs_type, int flags,
void *data, int (*fill_super)(struct super_block *, void *, int))
{
return mount_ns_userns(fs_type, flags, current_user_ns(), data,
fill_super);
}
EXPORT_SYMBOL(mount_ns); EXPORT_SYMBOL(mount_ns);
......
...@@ -1976,9 +1976,6 @@ struct file_system_type { ...@@ -1976,9 +1976,6 @@ struct file_system_type {
#define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME) #define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME)
extern struct dentry *mount_ns_userns(struct file_system_type *fs_type,
int flags, struct user_namespace *userns, void *data,
int (*fill_super)(struct super_block *, void *, int));
extern struct dentry *mount_ns(struct file_system_type *fs_type, int flags, extern struct dentry *mount_ns(struct file_system_type *fs_type, int flags,
void *data, int (*fill_super)(struct super_block *, void *, int)); void *data, int (*fill_super)(struct super_block *, void *, int));
extern struct dentry *mount_bdev(struct file_system_type *fs_type, extern struct dentry *mount_bdev(struct file_system_type *fs_type,
......
...@@ -326,10 +326,8 @@ static struct dentry *mqueue_mount(struct file_system_type *fs_type, ...@@ -326,10 +326,8 @@ static struct dentry *mqueue_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, int flags, const char *dev_name,
void *data) void *data)
{ {
struct ipc_namespace *ns = data;
if (!(flags & MS_KERNMOUNT)) { if (!(flags & MS_KERNMOUNT)) {
ns = current->nsproxy->ipc_ns; struct ipc_namespace *ns = current->nsproxy->ipc_ns;
/* Don't allow mounting unless the caller has CAP_SYS_ADMIN /* Don't allow mounting unless the caller has CAP_SYS_ADMIN
* over the ipc namespace. * over the ipc namespace.
*/ */
...@@ -338,8 +336,7 @@ static struct dentry *mqueue_mount(struct file_system_type *fs_type, ...@@ -338,8 +336,7 @@ static struct dentry *mqueue_mount(struct file_system_type *fs_type,
data = ns; data = ns;
} }
return mount_ns_userns(fs_type, flags, ns->user_ns, data, return mount_ns(fs_type, flags, data, mqueue_fill_super);
mqueue_fill_super);
} }
static void init_once(void *foo) static void init_once(void *foo)
......
...@@ -34,10 +34,8 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns, ...@@ -34,10 +34,8 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns,
ns->ns.ops = &ipcns_operations; ns->ns.ops = &ipcns_operations;
atomic_set(&ns->count, 1); atomic_set(&ns->count, 1);
ns->user_ns = get_user_ns(user_ns);
err = mq_init_ns(ns); err = mq_init_ns(ns);
if (err) { if (err) {
put_user_ns(ns->user_ns);
ns_free_inum(&ns->ns); ns_free_inum(&ns->ns);
kfree(ns); kfree(ns);
return ERR_PTR(err); return ERR_PTR(err);
...@@ -48,6 +46,8 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns, ...@@ -48,6 +46,8 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns,
msg_init_ns(ns); msg_init_ns(ns);
shm_init_ns(ns); shm_init_ns(ns);
ns->user_ns = get_user_ns(user_ns);
return ns; return ns;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment