From 2a5f487a16ac2390805459efad63bb556a8c0d84 Mon Sep 17 00:00:00 2001 From: Aleksey Katargin Date: Wed, 25 May 2016 09:45:07 +0500 Subject: [PATCH] netmap: close sw ring before hw rings Fix issue #1714 --- src/source-netmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/source-netmap.c b/src/source-netmap.c index 75f8d5d815..fdb4c707e7 100644 --- a/src/source-netmap.c +++ b/src/source-netmap.c @@ -474,7 +474,8 @@ static int NetmapClose(NetmapDevice *dev) pdev->ref--; if (!pdev->ref) { munmap(pdev->mem, pdev->memsize); - for (int i = 0; i <= pdev->rings_cnt; i++) { + // First close SW ring (https://github.com/luigirizzo/netmap/issues/144) + for (int i = pdev->rings_cnt; i >= 0; i--) { NetmapRing *pring = &pdev->rings[i]; close(pring->fd); SCSpinDestroy(&pring->tx_lock); -- 2.47.2