summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio/virtio.c
diff options
context:
space:
mode:
authorSteven <sluong@cisco.com>2018-03-30 22:18:11 -0700
committerSteven <sluong@cisco.com>2018-03-30 22:26:40 -0700
commit074f698be5c2e6afc9df776b56a366bc3f404d95 (patch)
treed41e847538899f077446d7fab10edcc33904752f /src/vnet/devices/virtio/virtio.c
parent3744fc7abce0cf8694d64b670589e35c6d7bf881 (diff)
tapv2: Sporadic SIGABRT in ethernet_input [VPP-1183]
virtio_free_rx_buffers uses the wrong slot in the vring to get the buffer index. It uses desc_next. It should be last_used_idx which is the slot number for the first valid descriptor. Change-Id: I6b62b794f06869fbffffce45430b8b2e37b1266c Signed-off-by: Steven <sluong@cisco.com>
Diffstat (limited to 'src/vnet/devices/virtio/virtio.c')
-rw-r--r--src/vnet/devices/virtio/virtio.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/vnet/devices/virtio/virtio.c b/src/vnet/devices/virtio/virtio.c
index aa9db3a0ef3..072e8a755b0 100644
--- a/src/vnet/devices/virtio/virtio.c
+++ b/src/vnet/devices/virtio/virtio.c
@@ -140,13 +140,13 @@ static_always_inline void
virtio_free_rx_buffers (vlib_main_t * vm, virtio_vring_t * vring)
{
u16 used = vring->desc_in_use;
- u16 next = vring->desc_next;
+ u16 last = vring->last_used_idx;
u16 mask = vring->size - 1;
while (used)
{
- vlib_buffer_free (vm, &vring->buffers[next], 1);
- next = (next + 1) & mask;
+ vlib_buffer_free (vm, &vring->buffers[last & mask], 1);
+ last++;
used--;
}
}