]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
netmap: close sw ring before hw rings
authorAleksey Katargin <gureedo@gmail.com>
Wed, 25 May 2016 04:45:07 +0000 (09:45 +0500)
committerVictor Julien <victor@inliniac.net>
Fri, 27 May 2016 08:43:27 +0000 (10:43 +0200)
Fix issue #1714

src/source-netmap.c

index 75f8d5d815087d6279ff84f5141604c7fbb09bee..fdb4c707e7f98bc08aa2d1128a04d64fe4f16a2b 100644 (file)
@@ -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);