make mntns ->get()/->put()/->install()/->inum() work with &mnt_ns->ns
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Родитель
435d5f4bb2
Коммит
58be28256d
|
@ -1582,6 +1582,11 @@ static bool is_mnt_ns_file(struct dentry *dentry)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct mnt_namespace *to_mnt_ns(struct ns_common *ns)
|
||||||
|
{
|
||||||
|
return container_of(ns, struct mnt_namespace, ns);
|
||||||
|
}
|
||||||
|
|
||||||
static bool mnt_ns_loop(struct dentry *dentry)
|
static bool mnt_ns_loop(struct dentry *dentry)
|
||||||
{
|
{
|
||||||
/* Could bind mounting the mount namespace inode cause a
|
/* Could bind mounting the mount namespace inode cause a
|
||||||
|
@ -1591,7 +1596,7 @@ static bool mnt_ns_loop(struct dentry *dentry)
|
||||||
if (!is_mnt_ns_file(dentry))
|
if (!is_mnt_ns_file(dentry))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
mnt_ns = get_proc_ns(dentry->d_inode)->ns;
|
mnt_ns = to_mnt_ns(get_proc_ns(dentry->d_inode)->ns);
|
||||||
return current->nsproxy->mnt_ns->seq >= mnt_ns->seq;
|
return current->nsproxy->mnt_ns->seq >= mnt_ns->seq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3146,14 +3151,14 @@ found:
|
||||||
|
|
||||||
static void *mntns_get(struct task_struct *task)
|
static void *mntns_get(struct task_struct *task)
|
||||||
{
|
{
|
||||||
struct mnt_namespace *ns = NULL;
|
struct ns_common *ns = NULL;
|
||||||
struct nsproxy *nsproxy;
|
struct nsproxy *nsproxy;
|
||||||
|
|
||||||
task_lock(task);
|
task_lock(task);
|
||||||
nsproxy = task->nsproxy;
|
nsproxy = task->nsproxy;
|
||||||
if (nsproxy) {
|
if (nsproxy) {
|
||||||
ns = nsproxy->mnt_ns;
|
ns = &nsproxy->mnt_ns->ns;
|
||||||
get_mnt_ns(ns);
|
get_mnt_ns(to_mnt_ns(ns));
|
||||||
}
|
}
|
||||||
task_unlock(task);
|
task_unlock(task);
|
||||||
|
|
||||||
|
@ -3162,13 +3167,13 @@ static void *mntns_get(struct task_struct *task)
|
||||||
|
|
||||||
static void mntns_put(void *ns)
|
static void mntns_put(void *ns)
|
||||||
{
|
{
|
||||||
put_mnt_ns(ns);
|
put_mnt_ns(to_mnt_ns(ns));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mntns_install(struct nsproxy *nsproxy, void *ns)
|
static int mntns_install(struct nsproxy *nsproxy, void *ns)
|
||||||
{
|
{
|
||||||
struct fs_struct *fs = current->fs;
|
struct fs_struct *fs = current->fs;
|
||||||
struct mnt_namespace *mnt_ns = ns;
|
struct mnt_namespace *mnt_ns = to_mnt_ns(ns);
|
||||||
struct path root;
|
struct path root;
|
||||||
|
|
||||||
if (!ns_capable(mnt_ns->user_ns, CAP_SYS_ADMIN) ||
|
if (!ns_capable(mnt_ns->user_ns, CAP_SYS_ADMIN) ||
|
||||||
|
@ -3200,8 +3205,8 @@ static int mntns_install(struct nsproxy *nsproxy, void *ns)
|
||||||
|
|
||||||
static unsigned int mntns_inum(void *ns)
|
static unsigned int mntns_inum(void *ns)
|
||||||
{
|
{
|
||||||
struct mnt_namespace *mnt_ns = ns;
|
struct ns_common *p = ns;
|
||||||
return mnt_ns->ns.inum;
|
return p->inum;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct proc_ns_operations mntns_operations = {
|
const struct proc_ns_operations mntns_operations = {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче