From nobody Fri Feb 17 18:16:43 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 4PJKlJ36HBz3rGZj; Fri, 17 Feb 2023 18:16:44 +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 4PJKlJ1yQCz3sXK; Fri, 17 Feb 2023 18:16:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676657804; 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=XA9et2vN+9CUA47xz0z9P2tI1aDvru91bBNlXn2G7LU=; b=ZfvueuiV/qrbRfr6hYYn/tT2/puDp+zJg+uUTCVgXcgXg6LX4TMVFD3xbaFFm8OsRSkuYy /rASqr+aVLR3MwcoJRMQIwxqp2Bs+eJL8V6zH6+icAn7FrVWJFMZZopYzSyWjZUwcYvTvT ywD3RY5P9OClTQ7aa9r27mdp6wqIWLQfpC9E0RGVx6dM7KZXzlj4B6s38j/i2Wv4YjbsNG WJbUVxR4eVJwBIykZugD2RERLKYI0jzTUMHscWqoiwb126QqX7JsoHE1dcgL00Y9CdlWbP Cc/Zc+TuxH2xQPwn9UbLBZraNosr5g4fvdDTo1Vt9bKCL0CnmsV0WzLqNoa8dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676657804; 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=XA9et2vN+9CUA47xz0z9P2tI1aDvru91bBNlXn2G7LU=; b=rpqlLFRogjeDiblPeQp6rb0INRfrRMFUiVT8KtZOcoRmPfAG8sy5wOc6HqKzDLY4fQIEWN avTVt1X/qR+uh4lWyz9eefwWxDNc5yBiUXr/gOVwgBKGaj8jhxkUMvWku1hk2ezs0C+BON hZDDy8D0aR6NetgCU3+FUsJa8iq0S7lHUgxs0dpCU/ea8h2MmwMGGmBcLLw1hm4jMAXsYq AiNXV/Qv2MRnDlde8gWH2ibPsD4NNIvgiJ4d5gqR1LserQ03CmbIWHm10KnbDY8Zg3lb65 E96x9cuknpa1ZRyv2viChUFsW+tSp2r8bYKvo6H2hhJsE/TbywTWniKtM6/hKQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676657804; a=rsa-sha256; cv=none; b=J4MsWFlZ4gW24wJbgcDK7vVpjGEBdqOtWZYbUzVJXDNUtqxlkhL+qABasu3C9RJlupmm+4 FmDylkpwJe6cvnkG0QmDu1MXlxFmkzULtp8GBbBr5xJfXMx+1tKFAjSanQpfc0g4JkXnCQ iDyD+i179gOt3Pta3lEzb1zwOwrjEqDAwiq0h9xh0TngePLJx11No5BAul+kCLUw+Ov8gR 4IDSSal8qxnfLEoLrneAIJ38pesqxRGYbDoMFO5SMuKVtqz2ZQKNTxZJJoWX52/1N0lUXt swgc7iZ/r3RXEEhO0Z1eR8mLIhauq+4AEVNLCqScxL7onYeEQi1OYdSrgjLmDg== 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 4PJKlJ0f5lzsT7; Fri, 17 Feb 2023 18:16:44 +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 31HIGhcf054314; Fri, 17 Feb 2023 18:16:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31HIGh5h054313; Fri, 17 Feb 2023 18:16:43 GMT (envelope-from git) Date: Fri, 17 Feb 2023 18:16:43 GMT Message-Id: <202302171816.31HIGh5h054313@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: f2f7911c5513 - main - netlink: validate rtable value in RTM_ROUTE. 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: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f2f7911c5513096e46422ad7756bc90c13c6e6d8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=f2f7911c5513096e46422ad7756bc90c13c6e6d8 commit f2f7911c5513096e46422ad7756bc90c13c6e6d8 Author: Alexander V. Chernikov AuthorDate: 2023-02-17 17:31:40 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-17 18:00:37 +0000 netlink: validate rtable value in RTM_ROUTE. Reported by: Stefan Grundmann MFC after: 1 day --- sys/netlink/route/rt.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sys/netlink/route/rt.c b/sys/netlink/route/rt.c index 59b34c53ad4b..aca69e75fea8 100644 --- a/sys/netlink/route/rt.c +++ b/sys/netlink/route/rt.c @@ -840,6 +840,11 @@ rtnl_handle_newroute(struct nlmsghdr *hdr, struct nlpcb *nlp, return (EINVAL); } + if (attrs.rta_table >= V_rt_numfibs) { + NLMSG_REPORT_ERR_MSG(npt, "invalid fib"); + return (EINVAL); + } + if (attrs.rta_nh_id != 0) { /* Referenced uindex */ int pxflag = get_pxflag(&attrs); @@ -898,6 +903,11 @@ rtnl_handle_delroute(struct nlmsghdr *hdr, struct nlpcb *nlp, return (ESRCH); } + if (attrs.rta_table >= V_rt_numfibs) { + NLMSG_REPORT_ERR_MSG(npt, "invalid fib"); + return (EINVAL); + } + error = rib_del_route_px(attrs.rta_table, attrs.rta_dst, attrs.rtm_dst_len, path_match_func, &attrs, 0, &rc); if (error == 0) @@ -915,6 +925,11 @@ rtnl_handle_getroute(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_pstate * if (error != 0) return (error); + if (attrs.rta_table >= V_rt_numfibs) { + NLMSG_REPORT_ERR_MSG(npt, "invalid fib"); + return (EINVAL); + } + if (hdr->nlmsg_flags & NLM_F_DUMP) error = handle_rtm_dump(nlp, attrs.rta_table, attrs.rtm_family, hdr, npt->nw); else