Commit 28b88310 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Pavel Emelyanov

sanitize ->mntinfo_list initialization in collect_mntinfo()

Currently this doesn't matter correctness-wise (with or without the
previous changes), but imho collect_mntinfo() needs a cleanup. We
should not return with ->mntinfo_list pointing to the freed memory
on failure, even if currently this failure is fatal and nobody will
ever use this pointer.
Signed-off-by: 's avatarOleg Nesterov <oleg@redhat.com>
Tested-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 4a15e112
...@@ -1493,7 +1493,7 @@ struct mount_info *collect_mntinfo(struct ns_id *ns, bool for_dump) ...@@ -1493,7 +1493,7 @@ struct mount_info *collect_mntinfo(struct ns_id *ns, bool for_dump)
{ {
struct mount_info *pm; struct mount_info *pm;
ns->mnt.mntinfo_list = pm = parse_mountinfo(ns->pid, ns, for_dump); pm = parse_mountinfo(ns->pid, ns, for_dump);
if (!pm) { if (!pm) {
pr_err("Can't parse %d's mountinfo\n", ns->pid); pr_err("Can't parse %d's mountinfo\n", ns->pid);
return NULL; return NULL;
...@@ -1503,6 +1503,7 @@ struct mount_info *collect_mntinfo(struct ns_id *ns, bool for_dump) ...@@ -1503,6 +1503,7 @@ struct mount_info *collect_mntinfo(struct ns_id *ns, bool for_dump)
if (ns->mnt.mntinfo_tree == NULL) if (ns->mnt.mntinfo_tree == NULL)
goto err; goto err;
ns->mnt.mntinfo_list = pm;
return pm; return pm;
err: err:
free_mntinfo(pm); free_mntinfo(pm);
......
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