tap: fix the segv 49/29649/3
authorMohsin Kazmi <sykazmi@cisco.com>
Wed, 28 Oct 2020 18:35:53 +0000 (19:35 +0100)
committerDamjan Marion <dmarion@me.com>
Thu, 29 Oct 2020 16:38:33 +0000 (16:38 +0000)
Type: fix

Change-Id: I53cb96950f8658d7159fb0bd8ecfa50b6977e5af
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
src/vnet/devices/tap/tap.c

index 6ad0177..aa9182a 100644 (file)
@@ -109,8 +109,11 @@ tap_free (vlib_main_t * vm, virtio_if_t * vif)
     virtio_vring_free_tx (vm, vif, TX_QUEUE (i));
   /* *INDENT-ON* */
 
-  _IOCTL (vif->tap_fds[0], TUNSETPERSIST, (void *) (uintptr_t) 0);
-  tap_log_dbg (vif, "TUNSETPERSIST: unset");
+  if (vif->tap_fds)
+    {
+      _IOCTL (vif->tap_fds[0], TUNSETPERSIST, (void *) (uintptr_t) 0);
+      tap_log_dbg (vif, "TUNSETPERSIST: unset");
+    }
 error:
   vec_foreach_index (i, vif->tap_fds) close (vif->tap_fds[i]);