Skip to content

Commit

Permalink
Do not destroy vif's napi context, if it was not initialised during a…
Browse files Browse the repository at this point in the history
…ddition

If the napi structure was not initialised during interface addition, because
of errors,  it should not be touched during the delete too, since doing a
netif_napi_del results in crash. However, there are no reliable checks to find
whether napi was initialised or not. Hence, for now we will check for the existance
poll function, which should have been set if the napi structure was initialised.

Closes BUG: #1399577

Change-Id: I8cf439dc53805801a5ba301f542dedb2aaa5dee2
  • Loading branch information
anandhk-juniper committed Dec 18, 2014
1 parent 083875d commit e3a0755
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions linux/vr_host_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -1585,8 +1585,18 @@ linux_if_del(struct vr_interface *vif)
else if (vif->vif_type == VIF_TYPE_PHYSICAL)
vhost_if_del_phys((struct net_device *)vif->vif_os);
else if (vif->vif_type == VIF_TYPE_VIRTUAL) {
napi_disable(&vif->vr_napi);
netif_napi_del(&vif->vr_napi);
/*
* if the napi structure was not initialised in the first place, we
* should not touch it now, since doing a netif_napi_del results in a
* crash. however, there are no reliable checks. hence, for now we
* will check for poll. ideally, we should not have had the napi
* structure itself in the interface structure and that would have
* clearly told us what to do with napi
*/
if (vif->vr_napi.poll) {
napi_disable(&vif->vr_napi);
netif_napi_del(&vif->vr_napi);
}
skb_queue_purge(&vif->vr_skb_inputq);
}

Expand Down

0 comments on commit e3a0755

Please sign in to comment.