virtio: fix the NULL deference
Type: fix
Change-Id: I8d55c2bfdd3c4607044370ebabf40cbac78b4996
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
diff --git a/src/vnet/devices/virtio/pci.c b/src/vnet/devices/virtio/pci.c
index 4877117..307e73b 100644
--- a/src/vnet/devices/virtio/pci.c
+++ b/src/vnet/devices/virtio/pci.c
@@ -1219,7 +1219,8 @@
if (vif->features & VIRTIO_FEATURE (VIRTIO_NET_F_CTRL_VQ))
vif->virtio_pci_func->del_queue (vm, vif, vif->max_queue_pairs * 2);
- vif->virtio_pci_func->device_reset (vm, vif);
+ if (vif->virtio_pci_func)
+ vif->virtio_pci_func->device_reset (vm, vif);
if (vif->hw_if_index)
{