Commit 7094e110 authored by Andrew Vagin's avatar Andrew Vagin Committed by Pavel Emelyanov

mount: stop doing anything if populate_mnt_ns() failed

Signed-off-by: 's avatarAndrew Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 96a12d47
...@@ -3161,6 +3161,8 @@ int prepare_mnt_ns(void) ...@@ -3161,6 +3161,8 @@ int prepare_mnt_ns(void)
ret = populate_mnt_ns(); ret = populate_mnt_ns();
if (!ret && opts.root) if (!ret && opts.root)
ret = cr_pivot_root(NULL); ret = cr_pivot_root(NULL);
if (ret)
return -1;
rst = open_proc(PROC_SELF, "ns/mnt"); rst = open_proc(PROC_SELF, "ns/mnt");
if (rst < 0) if (rst < 0)
...@@ -3207,7 +3209,7 @@ int prepare_mnt_ns(void) ...@@ -3207,7 +3209,7 @@ int prepare_mnt_ns(void)
return ret; return ret;
err: err:
if (rst) if (rst >= 0)
restore_ns(rst, &mnt_ns_desc); restore_ns(rst, &mnt_ns_desc);
return -1; return -1;
} }
......
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