git: 0084d0235649 - stable/13 - vtnet: don't leak pfil(9) data on detach

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Thu, 21 Dec 2023 18:42:28 UTC
The branch stable/13 has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=0084d02356494eb7a1b276ded9d37f3164a7248e

commit 0084d02356494eb7a1b276ded9d37f3164a7248e
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2022-01-05 02:41:05 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2023-12-21 18:41:48 +0000

    vtnet: don't leak pfil(9) data on detach
    
    PR:             260667
    Submitted by:   <ghuckriede blackberry.com>
    
    (cherry picked from commit 3f6ab5493f4b89e7625dd31f807065cfae6c503d)
---
 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 fc7634e9a821..9737e964a591 100644
--- a/sys/dev/virtio/network/if_vtnet.c
+++ b/sys/dev/virtio/network/if_vtnet.c
@@ -515,6 +515,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) {