From 108b15b4ef4844ef782639b9d9c3c71c222b5d9f Mon Sep 17 00:00:00 2001 From: Mohsin Kazmi Date: Wed, 28 Oct 2020 19:35:53 +0100 Subject: tap: fix the segv Type: fix Change-Id: I53cb96950f8658d7159fb0bd8ecfa50b6977e5af Signed-off-by: Mohsin Kazmi --- src/vnet/devices/tap/tap.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/vnet/devices') 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]); -- cgit 1.2.3-korg