From nobody Thu Oct 2 14:25:34 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 4ccvGQ72Fmz69DGB; Thu, 02 Oct 2025 14:25:34 +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 4ccvGQ5Ljcz3FR8; Thu, 02 Oct 2025 14:25:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759415134; 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=v/+R2i8RNCDAvdNF7Vq5snHjwYMT5dwNMc26ZZnUHaw=; b=GyEbD/bofyQ2fR1AIhTrH2iSiLQle3aas0Rs6NLv0/dUfrJtPV1UmnS+/jLS7sEWlUllHh QVAnPfx3SMHriSKKtySm7BJBuuspK0w3TkOCDA6ZY7hyPWpFaRGsyFRMI8SMqscCINuqHo Zjp3n7KO8ZfhWLs24LgFWaPvFVA2rWhfVLlw1lMNCU9TJPTsq/zDP6BVUkerTj1PO7qKXU QaFIXU4gWScx7T121IDw/gHMJjzRlYMsizf+jh/JWCWBb7l1okyeXAsCBQpA/G5og4Nnvu /YezB6OfuaeyJ8yq3q7OrUeCDHBSWM1rUuWbmCTOr1+GdPzSKZ8KZHNuILl4Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759415134; 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=v/+R2i8RNCDAvdNF7Vq5snHjwYMT5dwNMc26ZZnUHaw=; b=sDMW3fqgVIE8DyWr/WrXaF2qCQC8QPXZKpN+bM7NpNtT+ari5SpaNrw3o2VpH5TKqLoi47 oV2cRez6IZEo05WNE5tdiuuMxjPLMmPYXGqaKprESjhqXPfC+Dj62cG0ZvqtyoiDSTuiGs ex+KQwS5Fm4doOEzQBGWlXFcBw07cfSbvHiJf5C7QWdC9AvhAoY+a9NrGWB3EsXk7xm8vd 4/MQ7QWL9ON8/V+3s01/L7S2+0Ej7DjwW6nB64B9arkuukHhS1vax36NRs0N3VgFEzPsdK NdCYC4/KhsnLjZNz5x4aiOt8sM5Tbmn+Yq0QJ1x8E+t3Y1tt/pfAaLT9ToTC5g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1759415134; a=rsa-sha256; cv=none; b=K/mSro/D09YLYR7Jt8CmrppT1ecetGZJM7ieLPOqUVBguc67FX3rxs4Spfn8XikpFebrWO z+rrb7Dm3NaD/dWRcvyu40HAB8EijWbx8qh32QNRbeoKuTFX5w2h0Ki15XU9hDjikxzUIV ZRRnScmQ86ZjkwCAvJlTdBM6zhjmI+xua9/l7M16/0U66qoTAkr0UjfKmDBGQtb7np9AAA v0PTaR3l7e8X4w/xohFB4IE1RiUvJ87D10hvPJgJPTSNWIWltgj/rCsHR7mBOJ9am5AaZB 7DXFFcYIgo5Z7S3oVqnp7qWOb6X8PB+TW3IHv2NtfwJvJtw3nkP/BLL/fttGvw== 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 4ccvGQ4lpnz1BDK; Thu, 02 Oct 2025 14:25:34 +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 592EPYnF034146; Thu, 2 Oct 2025 14:25:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 592EPYXH034143; Thu, 2 Oct 2025 14:25:34 GMT (envelope-from git) Date: Thu, 2 Oct 2025 14:25:34 GMT Message-Id: <202510021425.592EPYXH034143@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: f9fc93690aef - main - sys/netinet6: fix memory corruption in in6_ifadd 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f9fc93690aef7a56f62a051de6231fe2af699728 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=f9fc93690aef7a56f62a051de6231fe2af699728 commit f9fc93690aef7a56f62a051de6231fe2af699728 Author: Mateusz Guzik AuthorDate: 2025-09-29 15:01:53 +0000 Commit: Kristof Provost CommitDate: 2025-10-02 13:33:17 +0000 sys/netinet6: fix memory corruption in in6_ifadd The routine allocates the wrong size and then passes it to in6_get_ifid. At the same time it violates invariants by issuing malloc with M_WAITOK while within net epoch section. Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netinet6/nd6_rtr.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index 78dc55dd292f..f9684b085767 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -1243,9 +1243,8 @@ in6_ifadd(struct nd_prefixctl *pr, int mcast) /* No suitable LL address, get the ifid directly */ if (ifid_addr == NULL) { - struct in6_addr taddr; - ifa = ifa_alloc(sizeof(taddr), M_WAITOK); - if (ifa) { + ifa = ifa_alloc(sizeof(struct in6_ifaddr), M_NOWAIT); + if (ifa != NULL) { ib = (struct in6_ifaddr *)ifa; ifid_addr = &ib->ia_addr.sin6_addr; if(in6_get_ifid(ifp, NULL, ifid_addr) != 0) {