diff mbox series

[OpenWrt-Devel,procd,2/2] jail: unnamed jails can not have netns (fix segfault)

Message ID 20200508005825.749631-2-me@irrelefant.net
State Under Review
Delegated to: Daniel Golle
Headers show
Series [OpenWrt-Devel,procd,1/2] jail: SIGSEGV must not be forwarded to the child process | expand

Commit Message

Leonardo Mörlein May 8, 2020, 12:58 a.m. UTC
Signed-off-by: Leonardo Mörlein <me@irrelefant.net>
---
 jail/jail.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/jail/jail.c b/jail/jail.c
index 67d4cad..a52c264 100644
--- a/jail/jail.c
+++ b/jail/jail.c
@@ -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);
 		}