From nobody Fri Feb 03 16:50:37 2023 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 4P7hVP3tTVz3kWDH; Fri, 3 Feb 2023 16:50:37 +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 4P7hVP3D6Dz3vBv; Fri, 3 Feb 2023 16:50:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675443037; 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=fi+/AuMoWgKS6x7e1pGrf6osY77m2MbDags3f3s0Wrw=; b=gv7Z86Am5Uig/Hu/Frgmf9+JeIG33k/+RKujq2TmkUW1/oFLCad4rPg3VZuJWCORM7vQsu VFD/nn58BpDnSJQR6oPUQmveBJf84nxcoyjBot+xUDnHr7mVW2wE9fYeHVT317q7KC+xJG dIoqb5dltIjG20D6CFy7QAi8CC8l56WO4KPVei8nolShS2ThNqm77tTMcGyvGeJNpeR28o yu3KgpWQOTC/SlZPXPj1Tq0nPbiORatcmSeQAKe2fwkZStzueNVFMvIBe/6ICqC9KJzfLl gAFyMgT7zhKe3j3vOoSKbkLl3nnuh9wtPdg5fpP57+gXmG8sZ75L0Yvb3oPmNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675443037; 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=fi+/AuMoWgKS6x7e1pGrf6osY77m2MbDags3f3s0Wrw=; b=H7Nrk82kJuMCiiC8r6y0C8huepbaKL4IsKMtNqzC0N34wWQnIvsGZtxe9mo00R/SAYgacG foM1MsCHzG1v6Iv1P5uZVROQondpi/PuwsMY6jd+wf6lsi6Qp9czMhwt6+sw7g7buK8OuE e4x2iJ8xfxVGmNh1z8WpCGJA2EngdnkialqWthTvHgW9O6CTAMCZB1PQ6QAOB+OnkJsl94 2JAnYQ5LZXf9qfh1SjRk/QB4yQylfiyp0azXNhFt+WfXv89+GKAZntqCB5+7Q3pzk8xHZS tw66gjULlTv8iJqCHIPyMznstYbzIulZZWBeVM1VxHbUuC2TG55tEEjnM4J7qQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675443037; a=rsa-sha256; cv=none; b=UGpZeEC2iwt7x30NzKWTqZzv+nzh6k5Fex8xhtg4s5hTE6J0RPC71FvKHhh8qlL3JB5zjm veAoe2mwyuzQwBbZ0EPsJrBmy2CNWMfw9E594Hlms938JD605/e4NiV7Xj3lZjSxpxjngu DVIbucwdCc5Wu3uSFkk848e/FYNeCuRpvsfb/uCH74lUcOS2GiVeP5gZLxtNNlahnoBSOG +rROtQimIVAbqlELrzmLAXdcRBcwz59ikW2Co9KSFNhEsuuenqbAVJrdz85G2CtmjGwUC4 IBwtLPAtJC6BVtm6IMPhDgvSoTD/u7Q0Zdd/pR1jBuNYqNdErwuOQEgWLOd0uQ== 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 4P7hVP2Jfhzhv1; Fri, 3 Feb 2023 16:50:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 313Gob1e009201; Fri, 3 Feb 2023 16:50:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 313Gob4V009198; Fri, 3 Feb 2023 16:50:37 GMT (envelope-from git) Date: Fri, 3 Feb 2023 16:50:37 GMT Message-Id: <202302031650.313Gob4V009198@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: b0ccf53f2455 - main - inpcb: Assert against wildcard addrs in in_pcblookup_hash_locked() 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/main X-Git-Reftype: branch X-Git-Commit: b0ccf53f2455ad300b8b784c4b1a91a5733e890f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b0ccf53f2455ad300b8b784c4b1a91a5733e890f commit b0ccf53f2455ad300b8b784c4b1a91a5733e890f Author: Mark Johnston AuthorDate: 2023-02-03 15:57:19 +0000 Commit: Mark Johnston CommitDate: 2023-02-03 16:48:25 +0000 inpcb: Assert against wildcard addrs in in_pcblookup_hash_locked() No functional change intended. Reviewed by: glebius MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D38361 --- sys/netinet/in_pcb.c | 4 ++++ sys/netinet6/in6_pcb.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 23d30d8b968a..ce8a58883be4 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -2242,6 +2242,10 @@ in_pcblookup_hash_locked(struct inpcbinfo *pcbinfo, struct in_addr faddr, KASSERT((lookupflags & ~(INPLOOKUP_WILDCARD)) == 0, ("%s: invalid lookup flags %d", __func__, lookupflags)); + KASSERT(faddr.s_addr != INADDR_ANY, + ("%s: invalid foreign address", __func__)); + KASSERT(laddr.s_addr != INADDR_ANY, + ("%s: invalid local address", __func__)); INP_HASH_LOCK_ASSERT(pcbinfo); /* diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index c3012ffab68f..0a4ae51cb5ef 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -980,6 +980,10 @@ in6_pcblookup_hash_locked(struct inpcbinfo *pcbinfo, struct in6_addr *faddr, KASSERT((lookupflags & ~(INPLOOKUP_WILDCARD)) == 0, ("%s: invalid lookup flags %d", __func__, lookupflags)); + KASSERT(!IN6_IS_ADDR_UNSPECIFIED(faddr), + ("%s: invalid foreign address", __func__)); + KASSERT(!IN6_IS_ADDR_UNSPECIFIED(laddr), + ("%s: invalid local address", __func__)); INP_HASH_LOCK_ASSERT(pcbinfo);