projects
/
project
/
procd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d2a2ecc
)
jail: netifd: check target netns fd before using it
author
Daniel Golle
<daniel@makrotopia.org>
Sun, 17 Oct 2021 08:34:55 +0000
(09:34 +0100)
committer
Daniel Golle
<daniel@makrotopia.org>
Sun, 17 Oct 2021 18:33:56 +0000
(19:33 +0100)
Make sure filehandler is non-negative before using it.
Coverity CID:
1492888
Negative returns
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
jail/netifd.c
patch
|
blob
|
history
diff --git
a/jail/netifd.c
b/jail/netifd.c
index f6f2df679451da9d34be824a106de4bf5a795424..0f05ccc2bae0d309b5fb9e2ec1848aca627c0d16 100644
(file)
--- a/
jail/netifd.c
+++ b/
jail/netifd.c
@@
-469,6
+469,10
@@
int jail_network_start(struct ubus_context *new_ctx, char *new_jail_name, pid_t
watch_ubus_service();
netns_fd = ns_open_pid("net", ns_pid);
+ if (netns_fd < 0) {
+ ret = ESRCH;
+ goto errout_inotify;
+ }
netns_updown(host_ubus_ctx, jail_name, true, netns_fd);