From: Mark Stapp Date: Fri, 21 Sep 2018 20:21:15 +0000 (-0400) Subject: zebra: improve safety of netns_notify_close() X-Git-Tag: frr-7.1-dev~233^2~2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=71077c48607aa9cf466958989f512e2d695307a2;p=matthieu%2Ffrr.git 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 --- 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); }