wg: detach bpf upon destroy as well

bpfattach() is called in wg_clone_create(), but the bpfdetach() is
missing from wg_close_destroy().  Add the missing bpfdetach() to avoid
leaking both the associated bpf bits as well as the ifnet that bpf will
hold a reference to.

PR:		276526

(cherry picked from commit 43be2d7aaf)
This commit is contained in:
Aaron LI 2024-01-22 10:18:56 -06:00 committed by Kyle Evans
parent ce2d249b20
commit 3deeb70f7f

View File

@ -2876,6 +2876,7 @@ wg_clone_destroy(struct if_clone *ifc, struct ifnet *ifp, uint32_t flags)
if (cred != NULL) if (cred != NULL)
crfree(cred); crfree(cred);
bpfdetach(sc->sc_ifp);
if_detach(sc->sc_ifp); if_detach(sc->sc_ifp);
if_free(sc->sc_ifp); if_free(sc->sc_ifp);