From 0d16880025a99fec0e30d4b6eea87e043542eb8b Mon Sep 17 00:00:00 2001 From: "Anand H. Krishnan" Date: Tue, 10 Mar 2015 17:28:26 +0530 Subject: [PATCH] Validate vif to device and device to vif linkage before using vif Once rps is done, the handler tries to extract vif from the control block. From that vif we try to get the dev and the rx_handler_data (which should be equal to the vif). From whatever information that was present in the trace, it was confirmed that rx_handler_data was null. There could be a case where agent restarts and is in the process of soft resetting the vrouter when this condition can happen. Since we do not have dump, for now we will check the linkages between vif and device (<=>) before proceeding with packet processing. Closes Bug: #1430279 Change-Id: I98066588c3c0d95f1327d505495f2058d9616a4d --- linux/vr_host_interface.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/linux/vr_host_interface.c b/linux/vr_host_interface.c index a2397319f..6ac502893 100644 --- a/linux/vr_host_interface.c +++ b/linux/vr_host_interface.c @@ -1074,7 +1074,9 @@ linux_rx_handler(struct sk_buff **pskb) vif = __vrouter_get_interface(router, ((vr_rps_t *)skb->cb)->vif_idx); if (vif && (vif->vif_type == VIF_TYPE_PHYSICAL) && vif->vif_os) { - dev = (struct net_device *) vif->vif_os; + dev = (struct net_device *)vif->vif_os; + if (!dev || (vif != rcu_dereference(dev->rx_handler_data))) + goto error; rpsdev = 1; } else { goto error;