From 71077c48607aa9cf466958989f512e2d695307a2 Mon Sep 17 00:00:00 2001 From: Mark Stapp Date: Fri, 21 Sep 2018 16:21:15 -0400 Subject: [PATCH] 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 --- zebra/zebra_netns_notify.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/zebra/zebra_netns_notify.c b/zebra/zebra_netns_notify.c index 2608ffd7a1..4d2aefa236 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); } -- 2.39.5