From: Utkarsh Srivastava Date: Thu, 10 Apr 2025 05:49:34 +0000 (-0700) Subject: pimd: Fix for crash during networking restart X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=b88cce233043806129eb6d8c938655b2886ec898;p=mirror%2Ffrr.git pimd: Fix for crash during networking restart During vrf delete, the vxlan_info.work_list linked list was deleted which is a global list containing the SGs for all the VRFs. If two vrfs are configured, vrf a and vrf b and both has SGs assocaited with them which are inserted in the vxlan_info.work_list. Now if vrf a is deleted, it deletes the work_list also. Due to this when any SG add or del comes for vrf b it tries to access the work_list and crashes. Fix Delete the vxlan_info.work_list only when all the VRFs are terminated and unset the vxlan_info.flags so if new add cmd comes it re-allocates the work_list. Signed-off-by: usrivastava-nvidia --- diff --git a/pimd/pim_instance.c b/pimd/pim_instance.c index f64b02e44d..e8f1a4e2d4 100644 --- a/pimd/pim_instance.c +++ b/pimd/pim_instance.c @@ -271,6 +271,8 @@ void pim_vrf_terminate(void) } vrf_terminate(); + /* Delete the vxlan_info.work_list as all the VRFs are deleted*/ + pim_vxlan_work_list_delete(); } bool pim_msdp_log_neighbor_events(const struct pim_instance *pim) diff --git a/pimd/pim_vxlan.c b/pimd/pim_vxlan.c index 511d35bf76..7c8d71a86c 100644 --- a/pimd/pim_vxlan.c +++ b/pimd/pim_vxlan.c @@ -1249,9 +1249,14 @@ void pim_vxlan_exit(struct pim_instance *pim) { hash_clean_and_free(&pim->vxlan.sg_hash, (void (*)(void *))pim_vxlan_sg_del_item); +} - if (vxlan_info.work_list) +void pim_vxlan_work_list_delete(void) +{ + if (vxlan_info.work_list) { list_delete(&vxlan_info.work_list); + UNSET_FLAG(vxlan_info.flags, PIM_VXLANF_WORK_INITED); + } } void pim_vxlan_terminate(void) diff --git a/pimd/pim_vxlan_instance.h b/pimd/pim_vxlan_instance.h index 65a5955851..839397b1b7 100644 --- a/pimd/pim_vxlan_instance.h +++ b/pimd/pim_vxlan_instance.h @@ -33,5 +33,6 @@ struct pim_vxlan_instance { extern void pim_vxlan_init(struct pim_instance *pim); extern void pim_vxlan_exit(struct pim_instance *pim); +void pim_vxlan_work_list_delete(void); #endif /* PIM_VXLAN_INSTANCE_H */