Commit 3d11c6c0 authored by Pavel Emelyanov's avatar Pavel Emelyanov

mnt: Sanitize prepare_mnt_ns nsids loop

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 68e2841a
...@@ -1650,19 +1650,15 @@ static int prepare_roots_yard(void) ...@@ -1650,19 +1650,15 @@ static int prepare_roots_yard(void)
if (mount("none", mnt_roots, NULL, MS_PRIVATE, NULL)) if (mount("none", mnt_roots, NULL, MS_PRIVATE, NULL))
return -1; return -1;
nsid = ns_ids; for (nsid = ns_ids; nsid != NULL; nsid = nsid->next) {
while (nsid) { if (nsid->nd != &mnt_ns_desc)
if (nsid->nd != &mnt_ns_desc) {
nsid = nsid->next;
continue; continue;
}
print_ns_root(nsid, path, sizeof(path)); print_ns_root(nsid, path, sizeof(path));
if (mkdir(path, 0600)) { if (mkdir(path, 0600)) {
pr_perror("Unable to create %s", path); pr_perror("Unable to create %s", path);
return -1; return -1;
} }
nsid = nsid->next;
} }
return 0; return 0;
......
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