Skip to content

Commit

Permalink
Add NULL check.
Browse files Browse the repository at this point in the history
The table could be deleted in the delete path, check for the same.
closes-bug: 1523854

Change-Id: I4ccbeb8b976e7ee7416cb9fb3a4353b0fae8a5c8
  • Loading branch information
haripk committed Dec 8, 2015
1 parent 02e14f2 commit ed12267
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/vnsw/agent/oper/vm_interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2430,6 +2430,8 @@ void VmInterface::DeleteMacVmBinding(const VrfEntry *old_vrf) {
return;
BridgeAgentRouteTable *table = static_cast<BridgeAgentRouteTable *>
(old_vrf->GetBridgeRouteTable());
if (table == NULL)
return;
Agent *agent = table->agent();
table->DeleteMacVmBindingRoute(agent->mac_vm_binding_peer(),
old_vrf->GetName(),
Expand Down Expand Up @@ -3062,6 +3064,8 @@ void VmInterface::DeleteL2InterfaceRoute(bool old_l2_active, VrfEntry *old_vrf,

EvpnAgentRouteTable *table = static_cast<EvpnAgentRouteTable *>
(old_vrf->GetEvpnRouteTable());
if (table == NULL)
return;
table->DelLocalVmRoute(peer_.get(), old_vrf->GetName(), mac,
this, old_v4_addr,
old_ethernet_tag);
Expand Down Expand Up @@ -3472,9 +3476,11 @@ void VmInterface::FloatingIp::L2DeActivate(VmInterface *interface) const {

EvpnAgentRouteTable *evpn_table = static_cast<EvpnAgentRouteTable *>
(vrf_->GetEvpnRouteTable());
evpn_table->DelLocalVmRoute(interface->peer_.get(), vrf_->GetName(),
MacAddress::FromString(interface->vm_mac()),
interface, floating_ip_, ethernet_tag_);
if (evpn_table) {
evpn_table->DelLocalVmRoute(interface->peer_.get(), vrf_->GetName(),
MacAddress::FromString(interface->vm_mac()),
interface, floating_ip_, ethernet_tag_);
}
ethernet_tag_ = 0;
l2_installed_ = false;
}
Expand Down Expand Up @@ -4016,10 +4022,10 @@ void VmInterface::ServiceVlanRouteDel(const ServiceVlan &entry) {
// Delete the L2 Recive routes added for smac_ and dmac_
BridgeAgentRouteTable *table = static_cast<BridgeAgentRouteTable *>
(entry.vrf_->GetBridgeRouteTable());
table->Delete(peer_.get(), entry.vrf_->GetName(), entry.dmac_,
0);
table->Delete(peer_.get(), entry.vrf_->GetName(), entry.smac_,
0);
if (table) {
table->Delete(peer_.get(), entry.vrf_->GetName(), entry.dmac_, 0);
table->Delete(peer_.get(), entry.vrf_->GetName(), entry.smac_, 0);
}
entry.installed_ = false;
return;
}
Expand Down

0 comments on commit ed12267

Please sign in to comment.