git: 3f6ab5493f4b - main - vtnet: don't leak pfil(9) data on detach

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Wed, 05 Jan 2022 02:42:11 UTC
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=3f6ab5493f4b89e7625dd31f807065cfae6c503d

commit 3f6ab5493f4b89e7625dd31f807065cfae6c503d
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2022-01-05 02:41:05 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2022-01-05 02:41:05 +0000

    vtnet: don't leak pfil(9) data on detach
    
    PR:             260667
    Submitted by:   <ghuckriede blackberry.com>
---
 sys/dev/virtio/network/if_vtnet.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c
index 913ae5e50efc..d52a1bfcdc23 100644
--- a/sys/dev/virtio/network/if_vtnet.c
+++ b/sys/dev/virtio/network/if_vtnet.c
@@ -518,6 +518,11 @@ vtnet_detach(device_t dev)
 	netmap_detach(ifp);
 #endif
 
+	if (sc->vtnet_pfil != NULL) {
+		pfil_head_unregister(sc->vtnet_pfil);
+		sc->vtnet_pfil = NULL;
+	}
+
 	vtnet_free_taskqueues(sc);
 
 	if (sc->vtnet_vlan_attach != NULL) {