diff options
author | Mohsin Kazmi <sykazmi@cisco.com> | 2020-10-28 19:35:53 +0100 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2020-10-29 16:38:33 +0000 |
commit | 108b15b4ef4844ef782639b9d9c3c71c222b5d9f (patch) | |
tree | 9488668e31c8b5e33d506e7bf860fc4382d9d3ea | |
parent | e4306b6749b66ceeb434b19b7b23d36443d3d4b8 (diff) |
tap: fix the segv
Type: fix
Change-Id: I53cb96950f8658d7159fb0bd8ecfa50b6977e5af
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
-rw-r--r-- | src/vnet/devices/tap/tap.c | 7 |
1 files changed, 5 insertions, 2 deletions
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]); |