From nobody Wed Feb 7 14:46:47 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 4TVNHC2cxDz59Vq1; Wed, 7 Feb 2024 14:46:47 +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 4TVNHC25csz4Dwh; Wed, 7 Feb 2024 14:46:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707317207; 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=2GlkcZb8AEj+vEviqGL+fOm7JEViAadE7SZjkSX0eJQ=; b=VAQ6y4ePwjlvmMe7b+OK5v/nQTGNBRVRbRZjwEHcWppeSYi8/en6YaX3KJoAeV0oyzstiX slvAB8KJAQ3bhyyPuBRBMvpd2wQg5QxlmbW8xwjCeulpRR5Hdo09VBMfzKGUoC4FC4MQDz DCSiyiLGDhSbj16gsGsbtqPXH8a9Q5/nwffet3/z7j8s8BfIUow1XzzZ5l32OOtD2eNekn A1NB5York2EDT724Xymqf0BUtr3WQMeH4qV3XOJQKIScOIXvt35aYbg0QgRrNfiGAvwoK1 Pfrqc69Luu2BysuIb3wAQ4DXlrSBXfes3WgoDLQ7UT5Lxqk688NGN3UIGmrUHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707317207; 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=2GlkcZb8AEj+vEviqGL+fOm7JEViAadE7SZjkSX0eJQ=; b=D+2H6WAHVVltjstgejy4aXrFwTqtH4zcyLAarvqeKmSqbynazNFF502R4dDpwTcgP8rk+G rJ1pe00udKOKZHOJf+z1YyZUbbHXMwtz1UekAsG5TyHp49rV4Yvv6cmpPuoT88eRuZG+nV D7fe+ienPzlEqmvLImeRGulgLvUSz3IGu/cvzG9fncP61kvihYNl+VMCMPRdsAgAPe2bGC 6mtObayPdJR1t0lLhv7vKn57IbWYotOoffXoJo7uZlDV+J532X1Th0ECqMdOtA826+pzmr biHrHvkUspJnBIXN4vWfsOSiEFDcaMIIRa/EDw6Jv7VcedOrfgPtpK+MpgqeUg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1707317207; a=rsa-sha256; cv=none; b=fDrtKPykz4fYF0GXtvxMp0ywNdePfD/HmOHuDupFe3Dl5TfE3N2PbtBiN5tqrMJ7rI1ibh ZU3rBzDvx3UznzdjaUjd+LTUebq7MYNuZFbJkhN8cDrVlOFeiEtBHDt+vBuLB9jdbct1k2 wm6VcAsm2xepZ3NPTi6M379yDdjOLhiUI+jGfoE8I4oxTu85KzXw8QQ8yKWHBZcSVNnHs6 8Wy7mKb7QZZMqNOmI38fBtwkIFJyVqOVUGFH9T1nt9RUZpxtTrxWRWF3j0oSTxlwpYuXe+ p39K79+G0Z3yaZ4PA3E42j3FInyGS4VJAsCFbPdAuCnm/Nnfu6BzSA1/jQj1YA== 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 4TVNHC12gLz19qZ; Wed, 7 Feb 2024 14:46:47 +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 417Ekl68019698; Wed, 7 Feb 2024 14:46:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 417Eklrc019695; Wed, 7 Feb 2024 14:46:47 GMT (envelope-from git) Date: Wed, 7 Feb 2024 14:46:47 GMT Message-Id: <202402071446.417Eklrc019695@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: fe8df7ed1aae - stable/13 - inpcb: Restore some NULL checks of credential pointers 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fe8df7ed1aae444a09361c080d52bfcb6aaae64f Auto-Submitted: auto-generated The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fe8df7ed1aae444a09361c080d52bfcb6aaae64f commit fe8df7ed1aae444a09361c080d52bfcb6aaae64f Author: Mark Johnston AuthorDate: 2024-02-07 14:43:25 +0000 Commit: Mark Johnston CommitDate: 2024-02-07 14:46:34 +0000 inpcb: Restore some NULL checks of credential pointers At least one out-of-tree port (net-mgmt/ng_ipacct) depends on being able to call in_pcblookup_local() with cred == NULL, so the MFC of commit ac1750dd143e ("inpcb: Remove NULL checks of credential references") broke compatibility. Restore a subset of the NULL checks to avoid breaking the module in the 13.3 release. This is a direct commit to stable/13. PR: 276868 --- sys/netinet/in_pcb.c | 6 ++++-- sys/netinet6/in6_pcb.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 001fd735cb4c..03315344a455 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -2003,7 +2003,8 @@ in_pcblookup_local(struct inpcbinfo *pcbinfo, struct in_addr laddr, /* * Found? */ - if (prison_equal_ip4(cred->cr_prison, + if (cred == NULL || + prison_equal_ip4(cred->cr_prison, inp->inp_cred->cr_prison)) return (inp); } @@ -2035,7 +2036,8 @@ in_pcblookup_local(struct inpcbinfo *pcbinfo, struct in_addr laddr, */ CK_LIST_FOREACH(inp, &phd->phd_pcblist, inp_portlist) { wildcard = 0; - if (!prison_equal_ip4(inp->inp_cred->cr_prison, + if (cred != NULL && + !prison_equal_ip4(inp->inp_cred->cr_prison, cred->cr_prison)) continue; #ifdef INET6 diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index ee32fbbf1688..2cfb2ec7b1c3 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -764,7 +764,8 @@ in6_pcblookup_local(struct inpcbinfo *pcbinfo, struct in6_addr *laddr, IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, laddr) && inp->inp_lport == lport) { /* Found. */ - if (prison_equal_ip6(cred->cr_prison, + if (cred == NULL || + prison_equal_ip6(cred->cr_prison, inp->inp_cred->cr_prison)) return (inp); } @@ -796,7 +797,8 @@ in6_pcblookup_local(struct inpcbinfo *pcbinfo, struct in6_addr *laddr, */ CK_LIST_FOREACH(inp, &phd->phd_pcblist, inp_portlist) { wildcard = 0; - if (!prison_equal_ip6(cred->cr_prison, + if (cred != NULL && + !prison_equal_ip6(cred->cr_prison, inp->inp_cred->cr_prison)) continue; /* XXX inp locking */