jail: unnamed jails can not have netns (fix segfault)
authorLeonardo Mörlein <me@irrelefant.net>
Fri, 8 May 2020 00:58:25 +0000 (02:58 +0200)
committerDaniel Golle <daniel@makrotopia.org>
Fri, 15 May 2020 18:10:43 +0000 (19:10 +0100)
Signed-off-by: Leonardo Mörlein <me@irrelefant.net>
jail/jail.c

index 67d4cadd4f2d887f5a77da04081d9ddbd098423e..a52c264c3fc2f90587541b6db1eb0b9557b56091 100644 (file)
@@ -841,6 +841,10 @@ int main(int argc, char **argv)
                }
 
                if (opts.namespace & CLONE_NEWNET) {
+                       if (!opts.name) {
+                               ERROR("netns needs a named jail\n");
+                               return -1;
+                       }
                        netns_fd = netns_open_pid(jail_process.pid);
                        netns_updown(jail_process.pid, true);
                }