[CRIU] [PATCH 5/5] sanitize ->mntinfo_list initialization in collect_mntinfo()
Oleg Nesterov
oleg at redhat.com
Tue Apr 14 09:54:14 PDT 2015
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: Oleg Nesterov <oleg at redhat.com>
---
mount.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/mount.c b/mount.c
index 78bb855..a3b4bc7 100644
--- a/mount.c
+++ b/mount.c
@@ -1493,7 +1493,7 @@ struct mount_info *collect_mntinfo(struct ns_id *ns, bool for_dump)
{
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) {
pr_err("Can't parse %d's mountinfo\n", ns->pid);
return NULL;
@@ -1503,6 +1503,7 @@ struct mount_info *collect_mntinfo(struct ns_id *ns, bool for_dump)
if (ns->mnt.mntinfo_tree == NULL)
goto err;
+ ns->mnt.mntinfo_list = pm;
return pm;
err:
free_mntinfo(pm);
--
1.5.5.1
More information about the CRIU
mailing list