From nobody Fri Nov 21 22:52:35 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dCr8M607Zz6Htyn for ; Fri, 21 Nov 2025 22:52:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dCr8M4kfxz49Rk for ; Fri, 21 Nov 2025 22:52:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763765555; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gNHran4DOTtYPMI+LQ/Dp7Gf+2f1MakjSKxRJk7w3T4=; b=ALmB/WFJxQ/s2yaZulhF0pLsOOLf4VO+KN+Wrs+xrNaPPPhzktegH12/MN/DPdXHp63go0 7DClaja48DBXXfmj/dMkHnZgFfV0Erq9yfiK7fnOXbsf1oxuaiRwQmaeOf7b91JqtYBGBr lmvPblY8h+kUYZSnnl9yG2dJ65gHQpcml7IIXso9gWvOilzvztvezhz9w/V2eKjEZ0cgKZ OahuQTpyCt9RUufktFl6FYuqLqNQ2vlWcpodPQ28hg3ILUZwk9lGpuk/44x+oAXZKy32D/ BuQblXR4GVq5J1zbmpwTFizdVGJ9q0crWUkGOz3tMOlEfeBsdoRwVIqg+fyBEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763765555; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gNHran4DOTtYPMI+LQ/Dp7Gf+2f1MakjSKxRJk7w3T4=; b=YWBpG0QW/S2mmM42HT0GpjnAfhDi4o+Y9CYrPDS+Tj+KwUZNJ2XyybkXTCnI5Yd6Rw8Zb6 KwARKp7AWZf45FeR3zbZIaKoT7QYSGxKIstvuZw9EcJG83vPVl8+O43GVm+5HsM6aOo4al ja/LmyqdwVwjXOK4xmFW3AFhvwCTfwSMW38qGglLcl1IZq67bisES8Rfbu9eeoe+lma/Q8 ldc5iBqUbFtDtU6BsrZtbWEoP0mZWFG4EhNL5iOuBu9ERI8Owcd+vt2zg2/sxnEZwoCqg8 EGGQQUfWtUF8TCdqbaL78mCmKovpyMO5wuc48Vnobr4QHLwnZuyTVaFTDhbKcA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1763765555; a=rsa-sha256; cv=none; b=N0XpbeI2EHO8KGGO9ofv35H40vWGdANtDvZbDzoB6JVSvonZLHu2DB/lgmL1if+qFhLOau i6kNH50LzqtxM/2LrXgNm2i1kEz8FvN84gaf1fZa2BQ6b1EhXmXSIS/QppSh8iAaZh6kMz C2+2jtXFs83rOrBUKsjpOuRmHEzOAp/5eLHhADIBh2OJycRSoaB9ER0eVEurIUwgIOTC4j mDTDaKw6SrQNiBm3jssyNRrxIlVHedcs4nLSiXs8Gpw1ZIS7P8PdViXUIs449zj5QP0UZp 97mkuWXQgdqkfzgz9WtD7YIzgvqQhxPCGkODoTGMGVPCgt01e7chAQRIGSwEZg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dCr8M4HJvzXcM for ; Fri, 21 Nov 2025 22:52:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3f935 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 21 Nov 2025 22:52:35 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: fd91012ebff2 - main - bpf: leave only locked version of bpf_detachd() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fd91012ebff2b2ff66e8b6faaa3a934a67069a6a Auto-Submitted: auto-generated Date: Fri, 21 Nov 2025 22:52:35 +0000 Message-Id: <6920ed33.3f935.6fec3741@gitrepo.freebsd.org> The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=fd91012ebff2b2ff66e8b6faaa3a934a67069a6a commit fd91012ebff2b2ff66e8b6faaa3a934a67069a6a Author: Gleb Smirnoff AuthorDate: 2025-11-21 22:49:04 +0000 Commit: Gleb Smirnoff CommitDate: 2025-11-21 22:50:44 +0000 bpf: leave only locked version of bpf_detachd() The unlocked one is used only once. No functional change. --- sys/net/bpf.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 0ce823412b91..f2deeda8e1ee 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -192,8 +192,7 @@ static void bpfif_rele(struct bpf_if *); static void bpfd_ref(struct bpf_d *); static void bpfd_rele(struct bpf_d *); static void bpf_attachd(struct bpf_d *, struct bpf_if *); -static void bpf_detachd(struct bpf_d *); -static void bpf_detachd_locked(struct bpf_d *, bool); +static void bpf_detachd(struct bpf_d *, bool); static void bpfd_free(epoch_context_t); static int bpf_movein(struct uio *, int, struct ifnet *, struct mbuf **, struct sockaddr *, int *, struct bpf_d *); @@ -733,7 +732,7 @@ bpf_attachd(struct bpf_d *d, struct bpf_if *bp) op_w = V_bpf_optimize_writers || d->bd_writer; if (d->bd_bif != NULL) - bpf_detachd_locked(d, false); + bpf_detachd(d, false); /* * Point d at bp, and add d to the interface's list. * Since there are many applications using BPF for @@ -843,15 +842,7 @@ bpf_check_upgrade(u_long cmd, struct bpf_d *d, struct bpf_insn *fcode, * Detach a file from its interface. */ static void -bpf_detachd(struct bpf_d *d) -{ - BPF_LOCK(); - bpf_detachd_locked(d, false); - BPF_UNLOCK(); -} - -static void -bpf_detachd_locked(struct bpf_d *d, bool detached_ifp) +bpf_detachd(struct bpf_d *d, bool detached_ifp) { struct bpf_if *bp; struct ifnet *ifp; @@ -923,7 +914,9 @@ bpf_dtor(void *data) d->bd_state = BPF_IDLE; BPFD_UNLOCK(d); funsetown(&d->bd_sigio); - bpf_detachd(d); + BPF_LOCK(); + bpf_detachd(d, false); + BPF_UNLOCK(); #ifdef MAC mac_bpfdesc_destroy(d); #endif /* MAC */ @@ -2839,12 +2832,12 @@ bpf_ifdetach(struct ifnet *ifp) /* Detach common descriptors */ while ((d = CK_LIST_FIRST(&bp->bif_dlist)) != NULL) { - bpf_detachd_locked(d, true); + bpf_detachd(d, true); } /* Detach writer-only descriptors */ while ((d = CK_LIST_FIRST(&bp->bif_wlist)) != NULL) { - bpf_detachd_locked(d, true); + bpf_detachd(d, true); } } BPF_UNLOCK(); @@ -2877,12 +2870,12 @@ bpfdetach(struct ifnet *ifp) /* Detach common descriptors */ while ((d = CK_LIST_FIRST(&bp->bif_dlist)) != NULL) { - bpf_detachd_locked(d, true); + bpf_detachd(d, true); } /* Detach writer-only descriptors */ while ((d = CK_LIST_FIRST(&bp->bif_wlist)) != NULL) { - bpf_detachd_locked(d, true); + bpf_detachd(d, true); } bpfif_rele(bp); }