diff options
| author | Donald Sharp <donaldsharp72@gmail.com> | 2024-10-16 15:23:38 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-16 15:23:38 -0400 |
| commit | d8fc147d2c2d19a5a21bd6c8caf13d98100b55a8 (patch) | |
| tree | c82e0b3c4828f9735b3b7a5111b78ff1884c736a /zebra/zebra_ns.c | |
| parent | a8c5175284997f6ae28f1d9bf75ffaa4d4f521d5 (diff) | |
| parent | bcdc8249b97b6aab7b9609c1cdfdf83e10e1b9e7 (diff) | |
Merge pull request #17143 from FRRouting/mergify/bp/dev/10.2/pr-17020
zebra: fix heap-use-after free on ns shutdown (backport #17020)
Diffstat (limited to 'zebra/zebra_ns.c')
| -rw-r--r-- | zebra/zebra_ns.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/zebra/zebra_ns.c b/zebra/zebra_ns.c index 803d8f0034..ffd749fcf1 100644 --- a/zebra/zebra_ns.c +++ b/zebra/zebra_ns.c @@ -175,6 +175,22 @@ int zebra_ns_early_shutdown(struct ns *ns, return NS_WALK_CONTINUE; } +/* During zebra shutdown, do kernel cleanup + * netlink sockets, .. + */ +int zebra_ns_kernel_shutdown(struct ns *ns, void *param_in __attribute__((unused)), + void **param_out __attribute__((unused))) +{ + struct zebra_ns *zns = ns->info; + + if (zns == NULL) + return NS_WALK_CONTINUE; + + kernel_terminate(zns, true); + + return NS_WALK_CONTINUE; +} + /* During zebra shutdown, do final cleanup * after all dataplane work is complete. */ @@ -185,9 +201,7 @@ int zebra_ns_final_shutdown(struct ns *ns, struct zebra_ns *zns = ns->info; if (zns == NULL) - return 0; - - kernel_terminate(zns, true); + return NS_WALK_CONTINUE; zebra_ns_delete(ns); |
