Skip to content

Commit

Permalink
[vnetorch] fix use-after-free in removeBfdSession() (#2366)
Browse files Browse the repository at this point in the history
* using a copy of monitor ip instead of a reference since the reference gets invalidated after the endpoint is erased

Signed-off-by: Yakiv Huryk <yhuryk@nvidia.com>
  • Loading branch information
Yakiv-Huryk authored Jul 5, 2022
1 parent 639d10e commit e84a901
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion orchagent/vnetorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1579,7 +1579,8 @@ void VNetRouteOrch::delEndpointMonitor(const string& vnet, NextHopGroupKey& next
if (nexthop_info_[vnet].find(ip) != nexthop_info_[vnet].end()) {
if (--nexthop_info_[vnet][ip].ref_count == 0)
{
removeBfdSession(vnet, nhk, nexthop_info_[vnet][ip].monitor_addr);
IpAddress monitor_addr = nexthop_info_[vnet][ip].monitor_addr;
removeBfdSession(vnet, nhk, monitor_addr);
}
}
}
Expand Down

0 comments on commit e84a901

Please sign in to comment.