Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Jan 2024 05:39:20 GMT
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 3deeb70f7f70 - stable/13 - wg: detach bpf upon destroy as well
Message-ID:  <202401300539.40U5dK0x019092@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kevans:

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

commit 3deeb70f7f70e5fbabde85efc7ea603cde915f6a
Author:     Aaron LI <aly@aaronly.me>
AuthorDate: 2024-01-22 16:18:56 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2024-01-30 05:38:01 +0000

    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 43be2d7aaf25b719aec8f49aab110c0061f1edec)
---
 sys/dev/wg/if_wg.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/dev/wg/if_wg.c b/sys/dev/wg/if_wg.c
index e961c9f24d94..89b5e52b7b2b 100644
--- a/sys/dev/wg/if_wg.c
+++ b/sys/dev/wg/if_wg.c
@@ -2876,6 +2876,7 @@ wg_clone_destroy(struct if_clone *ifc, struct ifnet *ifp, uint32_t flags)
 
 	if (cred != NULL)
 		crfree(cred);
+	bpfdetach(sc->sc_ifp);
 	if_detach(sc->sc_ifp);
 	if_free(sc->sc_ifp);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401300539.40U5dK0x019092>