git: 596bf3485fe5 - main - bpf: don't call bpf_detachd() in bpf_setdlt()

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Fri, 13 Feb 2026 19:39:56 UTC
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=596bf3485fe5dd62991e0f49ee783bc91d83678c

commit 596bf3485fe5dd62991e0f49ee783bc91d83678c
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2026-02-12 20:11:09 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2026-02-13 19:39:37 +0000

    bpf: don't call bpf_detachd() in bpf_setdlt()
    
    The bpf_attachd() will perform bpf_detachd() itself.  Performing it twice
    will lead to doing CK_LIST_REMOVE twice.
    
    Reported & tested by:   bz
---
 sys/net/bpf.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 228ac9867bd7..05877f6410a4 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -2821,7 +2821,6 @@ bpf_setdlt(struct bpf_d *d, u_int dlt)
 		return (EINVAL);
 
 	opromisc = d->bd_promisc;
-	bpf_detachd(d, false);
 	bpf_attachd(d, bp);
 	if (opromisc) {
 		error = bp->bif_methods->bif_promisc(bp->bif_softc, true);