diff options
author | Steven <sluong@cisco.com> | 2018-09-26 10:14:18 -0700 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-09-26 22:51:50 +0000 |
commit | 0296efdf587efa4eadd7b314c374aba15833a11d (patch) | |
tree | ff47e0b6d9d48420b56faef8c2d59ed09638beed /src/plugins/vmxnet3 | |
parent | fae833799f0c3398a18d1c0823e395345cdb9aa1 (diff) |
vmxnet3: delete interface causes a crash
Need to free the buffers starting from ring->consume+1, not ring->consume
Make use of the cool API vlib_buffer_free_from_ring
Fix a memory leak in vmxnet3_txq_init
Change-Id: I0a539ea75211408d84ce433d97a0a0aec5a9618d
Signed-off-by: Steven <sluong@cisco.com>
Diffstat (limited to 'src/plugins/vmxnet3')
-rw-r--r-- | src/plugins/vmxnet3/vmxnet3.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/plugins/vmxnet3/vmxnet3.c b/src/plugins/vmxnet3/vmxnet3.c index 2ff6d7969d2..9f2b8a8c596 100644 --- a/src/plugins/vmxnet3/vmxnet3.c +++ b/src/plugins/vmxnet3/vmxnet3.c @@ -274,6 +274,7 @@ vmxnet3_txq_init (vlib_main_t * vm, vmxnet3_device_t * vd, u16 qid, u16 qsz) if (txq->lock == 0) clib_spinlock_init (&txq->lock); vd->flags |= VMXNET3_DEVICE_F_SHARED_TXQ_LOCK; + return 0; } vec_validate_aligned (vd->txqs, qid, CLIB_CACHE_LINE_BYTES); @@ -623,15 +624,9 @@ vmxnet3_delete_if (vlib_main_t * vm, vmxnet3_device_t * vd) vmxnet3_rx_ring *ring; ring = &rxq->rx_ring[rid]; - desc_idx = ring->consume; - while (ring->fill) - { - desc_idx &= mask; - bi = ring->bufs[desc_idx]; - vlib_buffer_free_no_next (vm, &bi, 1); - ring->fill--; - desc_idx++; - } + desc_idx = (ring->consume + 1) & mask; + vlib_buffer_free_from_ring (vm, ring->bufs, desc_idx, rxq->size, + ring->fill); vec_free (ring->bufs); vlib_physmem_free (vm, vmxm->physmem_region, rxq->rx_desc[rid]); } |