summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio
diff options
context:
space:
mode:
authorSteven Luong <sluong@cisco.com>2019-08-15 14:30:16 -0700
committerAndrew Yourtchenko <ayourtch@gmail.com>2019-09-20 05:47:48 +0000
commit69dd1f5bceae81b2b422a410db0f72d12043c97d (patch)
tree08024c92935d1008916281b1227caabe3672e25d /src/vnet/devices/virtio
parent1d74eceb1f9ce20fcd9b9a4f9c9a21d03b697aeb (diff)
devices: vhost-user crashes displaying show trace for deleted interface
After the trace is collected and if the interface is then deleted, show trace may crash for the debug image. This is due to the additional check in pool_elt_at_index() to make sure that the block is not free. The fix is to do the check in vhost format trace and return "interface deleted" Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I0744f913ba6146609663443f408d784067880f93 (cherry picked from commit 5cd987dda679fe50b9cd7a834bb9162db39ade78)
Diffstat (limited to 'src/vnet/devices/virtio')
-rw-r--r--src/vnet/devices/virtio/vhost_user_inline.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/vnet/devices/virtio/vhost_user_inline.h b/src/vnet/devices/virtio/vhost_user_inline.h
index 27048c66186..8725c969046 100644
--- a/src/vnet/devices/virtio/vhost_user_inline.h
+++ b/src/vnet/devices/virtio/vhost_user_inline.h
@@ -214,13 +214,17 @@ format_vhost_trace (u8 * s, va_list * va)
CLIB_UNUSED (vnet_main_t * vnm) = vnet_get_main ();
vhost_user_main_t *vum = &vhost_user_main;
vhost_trace_t *t = va_arg (*va, vhost_trace_t *);
- vhost_user_intf_t *vui = pool_elt_at_index (vum->vhost_user_interfaces,
- t->device_index);
-
- vnet_sw_interface_t *sw = vnet_get_sw_interface (vnm, vui->sw_if_index);
-
- u32 indent = format_get_indent (s);
+ vhost_user_intf_t *vui = vum->vhost_user_interfaces + t->device_index;
+ vnet_sw_interface_t *sw;
+ u32 indent;
+ if (pool_is_free (vum->vhost_user_interfaces, vui))
+ {
+ s = format (s, "vhost-user interface is deleted");
+ return s;
+ }
+ sw = vnet_get_sw_interface (vnm, vui->sw_if_index);
+ indent = format_get_indent (s);
s = format (s, "%U %U queue %d\n", format_white_space, indent,
format_vnet_sw_interface_name, vnm, sw, t->qid);