From nobody Tue Jan 07 02:25:18 2025 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 4YRvz32TqFz5kdb1; Tue, 07 Jan 2025 02:25:19 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YRvz271Qkz4NDn; Tue, 7 Jan 2025 02:25:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736216719; 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=hIptlHw/qj0ZW/t1SCDoM7p6NX3/DZlmciQ050XVXCY=; b=vJspso0msE354TaQCXM/+wEoVERlwmeJfb815dAhw0JQ8gMUC4rU/qySFiJnydT4SINhb3 +o3Ils6OvxoK2fLveFVNEvFk4dl9Ed/lzV80t0ype31qqWLIFn5c0NDTciKfVfEDdl1RKe fAE96SzpywpZK8w7CSBTowCAbfCjGF/5LLiWoSqNRl0JfVYghcnwIGPiMQK9xKAFiGoxg3 fqdHJieFwpLmZoGX4JTzIyEC6+s3My8lALEJM0l1911oJRleO8M3vvZfQmRnF3lmbWolaX 8G2w0+aHMRsbK45BzW+EGxwcS5e3a/+AhfWNlTw5t37iZ9lvyHK/I7lI3x6aEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736216719; 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=hIptlHw/qj0ZW/t1SCDoM7p6NX3/DZlmciQ050XVXCY=; b=Yk9qZk42cblTxbrYI9TXEAGd94iHYs270nxbbNSfjKKn83k4UkcLC2yB6BtReX1X/Teco9 IQ7pUskLs5MtW04tvZ3eXWjlmDgO7lW1ji5UnfdOsKYWEwd89h+sW1x0lYihJt8vy/rwQm yVsacNhM48wI/hA9ydyOXq0iSn8cLCpjsGVIBGZfKedK7dZWoYgsPuouXPufoxKapUw5XP bRSfsyKQL2RhTiJ6hyeeAXLhjI84W1BDUMghGyR+lqj/VyFFPPQNcCSVizBO/kOkNjQxh6 zjhcCskAX3ZOvNrSYdX4kuwRK8yIDs3HaEcUc8STpUxUg2/Euenh5RjS0HMH4Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736216719; a=rsa-sha256; cv=none; b=g2yGHmqihZjm+g1tLtbooPQNJckF9aXCF6Gods3Ivwhi0PKkYNZ27m5RvYBBZVQ7++UF/H TJrbaTXigaZ8F5W4nVtIZ8cN2sVuDsMLOTvVMaPGud0JBCiCBZi+HF9Z2FGFyGDz7+gJyx Q/n2445D3ieeQeLiiD0GElbB8qW/BkxvtgdDbVxkirh4aoBlTVczQT83gLFzXP+xei3XKV IFmlLJCL2IoW8/EqlwUCCJiTfy+NGV0APC51BnPsKPei77kf7RtwHEyM62A2dAy4esPFV5 xeMhz0jI0TGucacyul5nWHlzRWw+IzO3hyM5jUKnrOvAeMRAXFwQGxVi37P1Kw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YRvz26czxzrLc; Tue, 07 Jan 2025 02:25:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5072PIJE046087; Tue, 7 Jan 2025 02:25:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5072PIv8046084; Tue, 7 Jan 2025 02:25:18 GMT (envelope-from git) Date: Tue, 7 Jan 2025 02:25:18 GMT Message-Id: <202501070225.5072PIv8046084@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: fd94571ccf0c - main - rawip: Take the inpcb lock when appropriate in rip_ctloutput() 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fd94571ccf0c9c6521063c08a72a760873e87897 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fd94571ccf0c9c6521063c08a72a760873e87897 commit fd94571ccf0c9c6521063c08a72a760873e87897 Author: Mark Johnston AuthorDate: 2025-01-07 02:20:05 +0000 Commit: Mark Johnston CommitDate: 2025-01-07 02:20:05 +0000 rawip: Take the inpcb lock when appropriate in rip_ctloutput() Reviewed by: glebius MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D48344 --- sys/netinet/raw_ip.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index a6bef1c7e275..3a0b9f632fb4 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -625,8 +625,6 @@ rip_send(struct socket *so, int pruflags, struct mbuf *m, struct sockaddr *nam, * * When adding new socket options here, make sure to add access control * checks here as necessary. - * - * XXX-BZ inp locking? */ int rip_ctloutput(struct socket *so, struct sockopt *sopt) @@ -637,7 +635,9 @@ rip_ctloutput(struct socket *so, struct sockopt *sopt) if (sopt->sopt_level != IPPROTO_IP) { if ((sopt->sopt_level == SOL_SOCKET) && (sopt->sopt_name == SO_SETFIB)) { + INP_WLOCK(inp); inp->inp_inc.inc_fibnum = so->so_fibnum; + INP_WUNLOCK(inp); return (0); } return (EINVAL); @@ -707,10 +707,12 @@ rip_ctloutput(struct socket *so, struct sockopt *sopt) sizeof optval); if (error) break; + INP_WLOCK(inp); if (optval) inp->inp_flags |= INP_HDRINCL; else inp->inp_flags &= ~INP_HDRINCL; + INP_WUNLOCK(inp); break; case IP_FW3: /* generic ipfw v.3 functions */