]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: improve safety of netns_notify_close()
authorMark Stapp <mjs@voltanet.io>
Fri, 21 Sep 2018 20:21:15 +0000 (16:21 -0400)
committerMark Stapp <mjs@voltanet.io>
Thu, 25 Oct 2018 12:57:04 +0000 (08:57 -0400)
Additional check to ensure the notify event is still valid
before calling the thread lib api.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
zebra/zebra_netns_notify.c

index 2608ffd7a1b77d94611d5201d07476e029ea10f4..4d2aefa2362fd5dd5b0b5312e2d9da3ee0af156c 100644 (file)
@@ -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);
 }