]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Prevent crash because nl is NULL on shutdown
authorDonald Sharp <sharpd@nvidia.com>
Thu, 8 Jun 2023 16:03:49 +0000 (12:03 -0400)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Fri, 9 Jun 2023 04:45:36 +0000 (04:45 +0000)
When shutting down the main pthread was first closing
the sockets associated with the dplane pthread and
then telling it to shutdown the pthread at a later point
in time.  This caused the dplane to crash because the nl
data has been freed already.  Change the shutdown order
to stop the dplane pthread *and* then close the sockets.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 977d7e24fff4e0eef4426bbcc32e491a60815b89)

zebra/main.c

index 81a30664453a5e43ebd247a7ae8a919bb7817afc..bd4623be555607ef0105a7f3d765f2270e6fd73a 100644 (file)
@@ -206,12 +206,17 @@ void zebra_finalize(struct event *dummy)
 
        vrf_terminate();
 
+       /*
+        * Stop dplane thread and finish any cleanup
+        * This is before the zebra_ns_early_shutdown call
+        * because sockets that the dplane depends on are closed
+        * in those functions
+        */
+       zebra_dplane_shutdown();
+
        ns_walk_func(zebra_ns_early_shutdown, NULL, NULL);
        zebra_ns_notify_close();
 
-       /* Stop dplane thread and finish any cleanup */
-       zebra_dplane_shutdown();
-
        /* Final shutdown of ns resources */
        ns_walk_func(zebra_ns_final_shutdown, NULL, NULL);