From 7094e110a38fc8f91f273304733eebcca9b5f102 Mon Sep 17 00:00:00 2001 From: Andrew Vagin Date: Tue, 8 Dec 2015 19:02:00 +0300 Subject: [PATCH] mount: stop doing anything if populate_mnt_ns() failed Signed-off-by: Andrew Vagin Signed-off-by: Pavel Emelyanov --- mount.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mount.c b/mount.c index ec8855362..eb80f80ce 100644 --- a/mount.c +++ b/mount.c @@ -3161,6 +3161,8 @@ int prepare_mnt_ns(void) ret = populate_mnt_ns(); if (!ret && opts.root) ret = cr_pivot_root(NULL); + if (ret) + return -1; rst = open_proc(PROC_SELF, "ns/mnt"); if (rst < 0) @@ -3207,7 +3209,7 @@ int prepare_mnt_ns(void) return ret; err: - if (rst) + if (rst >= 0) restore_ns(rst, &mnt_ns_desc); return -1; }