When iterating over the bgp_dest table, using this pattern:
for (dest = bgp_table_top(table); dest;
dest = bgp_route_next(dest)) {
If the code breaks or returns in the middle we will not have
properly unlocked the node as that bgp_table_top locks the top
dest and bgp_route_next locks the next dest and unlocks the old
dest.
From code inspection I have found a bunch of places that
we either return in the middle of or a break is issued.
Add appropriate unlocks.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
sizeof(buf)),
vrf_id_to_name(
bgp_vrf->vrf_id));
+ bgp_dest_unlock_node(rd_dest);
+ bgp_dest_unlock_node(dest);
return ret;
}
}
? "MACIP"
: "IMET",
vpn->vni);
+
+ bgp_dest_unlock_node(rd_dest);
+ bgp_dest_unlock_node(dest);
return ret;
}
}
prefix2str(evp, buf,
sizeof(buf)),
es->esi_str);
+
+ bgp_dest_unlock_node(rd_rn);
+ bgp_dest_unlock_node(rn);
return ret;
}
}
break;
}
}
- if (ret == RMAP_PERMITMATCH)
+ if (ret == RMAP_PERMITMATCH) {
+ bgp_dest_unlock_node(dest);
break;
+ }
}
bgp->peer_self->rmap_type = 0;