Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: fix crash on distribute-list delete #16530

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

idryzhov
Copy link
Contributor

@idryzhov idryzhov commented Aug 7, 2024

The destroy callback must be executed only once on APPLY stage.

Fixes #16528

The destroy callback must be executed only once on APPLY stage.

Fixes FRRouting#16528

Signed-off-by: Igor Ryzhov <[email protected]>
@@ -458,6 +458,8 @@ int group_distribute_list_create_helper(

int group_distribute_list_destroy(struct nb_cb_destroy_args *args)
{
if (args->event != NB_EV_APPLY)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would this be a better fix:

diff --git a/lib/northbound.c b/lib/northbound.c
index 0bc79d0277..6158fb5ada 100644
--- a/lib/northbound.c
+++ b/lib/northbound.c
@@ -1585,7 +1585,8 @@ static int nb_callback_destroy(struct nb_context *context,
        args.dnode = dnode;
        args.errmsg = errmsg;
        args.errmsg_len = errmsg_len;
-       ret = nb_node->cbs.destroy(&args);
+       if (args.event == NB_EV_APPLY)
+               ret = nb_node->cbs.destroy(&args);
 
        /* Detect and log unexpected errors. */
        switch (ret) {

I spot checked a few other destroy functions and they all had this check.

@ton31337
Copy link
Member

ton31337 commented Aug 8, 2024

@Mergifyio backport stable/10.1 stable/10.0

Copy link

mergify bot commented Aug 8, 2024

backport stable/10.1 stable/10.0

✅ Backports have been created

@donaldsharp donaldsharp merged commit e7fd713 into FRRouting:master Aug 8, 2024
16 checks passed
donaldsharp added a commit that referenced this pull request Aug 8, 2024
lib: fix crash on distribute-list delete (backport #16530)
donaldsharp added a commit that referenced this pull request Aug 8, 2024
lib: fix crash on distribute-list delete (backport #16530)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ripd crash
3 participants