From nobody Thu Jan 11 12:40:41 2024 X-Original-To: dev-commits-src-all@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 4T9km95DCbz55dCp; Thu, 11 Jan 2024 12:40:41 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T9km93Dn8z46Br; Thu, 11 Jan 2024 12:40:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704976841; 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=DprmClRYTEo1I1Y7rysS5Hb4/iKi3YIalqXkduUIPoc=; b=t8SDjgZMKd29yBvYMGJd1g0UkE3HY1Zi+5gm3NpaW8yndQewlVEP/Mukzc4Drjw5jKwN0I ijSEsyZBs7WcHG8slptWygL6tRmh6tf3V/P0Pt5H7KjNOtiaw9qH9lTUOrstMunJFANpRc oLTlCNuhMMwNKdpRKoEOFtTtwwar+Ld5+N8md/RTXl6kQFCy2qsU4SzuNnHqZMeg8rOvcC 0LC3KBoznaFYlqPBL7OCzVaehEoFWyiqXgnRcKtPqtYw/KueXBkuCi4zq0thyjMI/2LuCA oi/dQYYN8v/q9DDSIyOmZtJqnELlgxlJ7c5ZZn7QdzwiIwEbttD0RTO0eSTX4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704976841; 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=DprmClRYTEo1I1Y7rysS5Hb4/iKi3YIalqXkduUIPoc=; b=lCrua9181h0zzldNmoY04WM76g+G1E1sAmylRNCxSWzSWOZS1avTEgQSIh7TKv+lFQbRmo NNN7NgtCtLmw9C49WfQoAe4fnEpHl+v0TDJOVMJC59lvOZFXt7Vv8ZX42/QISVb757ReDl ohv+YR0c+V0Mr88evMPIRIc99+Rs4dFts9r+/zOW5vYww/txIDqGEnURGXWmX9IVhavWG8 7y3e4WjeQ3nJj5GTZO2O+7HD9KZ2zLeImZwa5qUE7zvpcNvPnLqabcDlfZo/N6eg8o128g xZEz8LLroou+oP0J9PFScGUXldGtIVA2QU9CodWC7IuWUckHCHh5jHbluhBJiw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704976841; a=rsa-sha256; cv=none; b=vesswibJQb36EEBkEt54kCgZxGkmooU2G4kSl6vxikGqwXOFpBbKiIBx5pBL+cFH7CCsPJ zqcITHVulCKdYaAdXCoeFNtxcJoX77hhc0Q9g99isEieriP+OgF8qoXC7Q00yL0/iGpVPz 80xg6zyxLxloXGSQB49j/cftj0/LUeY8TkY3Uew2zif6LHiKbUGPOOzyoMKBTrirG6yk9S 1l9osyzgTj4Ra6umiuoUJ9C2cV2n6VdjlLe+STEips2yC3hrWx+KzVJpTthKt74JxI3sSl iivKD99wj5GQ9pS0WRWlp0CSuo5bPyzSB0m+noUG2eSRzd5o1zIxvvlYEqxYow== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T9km92KNCzJs9; Thu, 11 Jan 2024 12:40:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40BCef7w028887; Thu, 11 Jan 2024 12:40:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40BCefgq028884; Thu, 11 Jan 2024 12:40:41 GMT (envelope-from git) Date: Thu, 11 Jan 2024 12:40:41 GMT Message-Id: <202401111240.40BCefgq028884@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: c9e9bfc22e6d - stable/13 - sctp: use consistent names for locking macros List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c9e9bfc22e6da6969bbb39920a7090a31ee988b5 Auto-Submitted: auto-generated The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=c9e9bfc22e6da6969bbb39920a7090a31ee988b5 commit c9e9bfc22e6da6969bbb39920a7090a31ee988b5 Author: Michael Tuexen AuthorDate: 2023-08-13 20:32:54 +0000 Commit: Michael Tuexen CommitDate: 2024-01-11 12:40:04 +0000 sctp: use consistent names for locking macros While there, add also a macro for an assert. Will be used shortly. No functional change intended. (cherry picked from commit 6cb8b3b5cde18ac5465f1cf1df3fbac359cb09e9) --- sys/netinet/sctp_lock_bsd.h | 9 +++++++-- sys/netinet/sctp_pcb.c | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/sys/netinet/sctp_lock_bsd.h b/sys/netinet/sctp_lock_bsd.h index 1ff5c87a1163..4e9197917a9e 100644 --- a/sys/netinet/sctp_lock_bsd.h +++ b/sys/netinet/sctp_lock_bsd.h @@ -232,12 +232,12 @@ * or cookie secrets we lock the INP level. */ -#define SCTP_INP_READ_INIT(_inp) do { \ +#define SCTP_INP_READ_LOCK_INIT(_inp) do { \ mtx_init(&(_inp)->inp_rdata_mtx, "sctp-read", "inpr", \ MTX_DEF | MTX_DUPOK); \ } while (0) -#define SCTP_INP_READ_DESTROY(_inp) do { \ +#define SCTP_INP_READ_LOCK_DESTROY(_inp) do { \ mtx_destroy(&(_inp)->inp_rdata_mtx); \ } while (0) @@ -249,6 +249,11 @@ mtx_unlock(&(_inp)->inp_rdata_mtx); \ } while (0) +#define SCTP_INP_READ_LOCK_ASSERT(_inp) do { \ + KASSERT(mtx_owned(&(_inp)->inp_rdata_mtx), \ + ("Don't own INP read queue lock")); \ +} while (0) + #define SCTP_INP_LOCK_INIT(_inp) do { \ mtx_init(&(_inp)->inp_mtx, "sctp-inp", "inp", \ MTX_DEF | MTX_DUPOK); \ diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 2cb3f6874df9..15f406eae32d 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -2498,7 +2498,7 @@ sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id) SCTP_INP_INFO_WLOCK(); SCTP_INP_LOCK_INIT(inp); INP_LOCK_INIT(&inp->ip_inp.inp, "inp", "sctpinp"); - SCTP_INP_READ_INIT(inp); + SCTP_INP_READ_LOCK_INIT(inp); SCTP_ASOC_CREATE_LOCK_INIT(inp); /* lock the new ep */ SCTP_INP_WLOCK(inp); @@ -3675,7 +3675,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from) crfree(inp->ip_inp.inp.inp_cred); INP_LOCK_DESTROY(&inp->ip_inp.inp); SCTP_INP_LOCK_DESTROY(inp); - SCTP_INP_READ_DESTROY(inp); + SCTP_INP_READ_LOCK_DESTROY(inp); SCTP_ASOC_CREATE_LOCK_DESTROY(inp); SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_ep), inp); SCTP_DECR_EP_COUNT();