Skip to content

Commit

Permalink
Remove the vhost tap if the physical interface corresponsing to a vhost
Browse files Browse the repository at this point in the history
interface changes

If before a vrouter soft reset the physical interface was different and
post reset agent adds a different physical interface (corresponding to a
particular vhost), then a system crash is possible subsequently when
somebody tries to remove the module. (This situation can happen  because
interfaces mentioned in agent_param and contrail-vrouter-agent.conf are
different. Unlikely, but possible).

The system crash is because during reset we install a handler on the
physical interface that directly shunts the packet to vhost interface in
the kernel. Post reset, if the interface changes, we don't remove this tap.
If we then remove the vrouter module, the tap points to the module function
and hence an invalid memory.

Change-Id: I28d4a7691d7caea81f849110edf7c7f7170b0bc5
Closes-BUG: #1394473
  • Loading branch information
anandhk-juniper committed Mar 23, 2015
1 parent e3a0755 commit a701b0d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions linux/vhost_dev.c
Expand Up @@ -226,6 +226,15 @@ vhost_if_add(struct vr_interface *vif)
vp->vp_vifp = vif;
if (vif->vif_type == VIF_TYPE_HOST) {
if (vif->vif_bridge) {
/*
* if there already was an association, need to remove that
*/
if ((vp->vp_phys_dev) &&
(vp->vp_phys_dev !=
((struct net_device *)vif->vif_bridge->vif_os))) {
vhost_del_tap_phys(vp->vp_phys_dev);
}

vp->vp_phys_dev =
(struct net_device *)vif->vif_bridge->vif_os;
strncpy(vp->vp_phys_name, vp->vp_phys_dev->name,
Expand Down
3 changes: 3 additions & 0 deletions linux/vr_host_interface.c
Expand Up @@ -1323,6 +1323,9 @@ vr_interface_common_hook(struct sk_buff *skb)
vif = vr_get_vif_ptr(skb->dev);
}

if (!vif)
goto error;

#if 0
if(vrouter_dbg) {
__skb_dump_info("vr_intf_br_hk:", skb, vif);
Expand Down

0 comments on commit a701b0d

Please sign in to comment.