From: Mohsin Kazmi Date: Wed, 28 Oct 2020 18:35:53 +0000 (+0100) Subject: tap: fix the segv X-Git-Tag: v21.06-rc0~247 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=108b15b4ef4844ef782639b9d9c3c71c222b5d9f;p=vpp.git tap: fix the segv Type: fix Change-Id: I53cb96950f8658d7159fb0bd8ecfa50b6977e5af Signed-off-by: Mohsin Kazmi --- diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c index 6ad01770cf0..aa9182a58f7 100644 --- a/src/vnet/devices/tap/tap.c +++ b/src/vnet/devices/tap/tap.c @@ -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]);