summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_netns_notify.c
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2018-09-21 22:21:15 +0200
committerMark Stapp <mjs@voltanet.io>2018-10-25 14:57:04 +0200
commit71077c48607aa9cf466958989f512e2d695307a2 (patch)
treec83f28cde62c55b5760dc0b5862b1927f49748bf /zebra/zebra_netns_notify.c
parentzebra: limit queued route updates (diff)
downloadfrr-71077c48607aa9cf466958989f512e2d695307a2.tar.xz
frr-71077c48607aa9cf466958989f512e2d695307a2.zip
zebra: improve safety of netns_notify_close()
Additional check to ensure the notify event is still valid before calling the thread lib api. Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'zebra/zebra_netns_notify.c')
-rw-r--r--zebra/zebra_netns_notify.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/zebra/zebra_netns_notify.c b/zebra/zebra_netns_notify.c
index 2608ffd7a..4d2aefa23 100644
--- a/zebra/zebra_netns_notify.c
+++ b/zebra/zebra_netns_notify.c
@@ -353,8 +353,11 @@ void zebra_ns_notify_close(void)
if (zebra_netns_notify_current->u.fd > 0)
fd = zebra_netns_notify_current->u.fd;
- thread_cancel(zebra_netns_notify_current);
- /* auto-removal of inotify items */
+
+ if (zebra_netns_notify_current->master != NULL)
+ thread_cancel(zebra_netns_notify_current);
+
+ /* auto-removal of notify items */
if (fd > 0)
close(fd);
}