From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 28B1A1CFEA9; Tue, 15 Oct 2024 11:58:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728993487; cv=none; b=dDfY7uprltwm3EZ1WW4SyFVs2FpbsQTRbACKeFqqBHwbFi2FNHkO+3s/GZF9QKhai4CaA+si2b2Y9ZnhiP2UPqsOA2t4GpaiBrHn49qWsMYDpFDEmLkSR42M+BE8UBx/mtTrLo5fB9ES0eUFAnG5sxHfoZyHnvadfrFUakbgOic= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728993487; c=relaxed/simple; bh=qeRozlmTzf3NmxCs8AvsieegKaackQdpX8kBdUBX/jA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ilP9Cg80vDpUDmsOh8B6WBk0Vf1zeblOCqJXzdZouilkHY+GF807+B7jL7HuOvd5lKTgZ3l5hdbPOtfedI8lJHpmbUwMJiTzl2Ok4Y+OiBo4qQYvupLltP9WDKLidPMexG4gnvONNNVKUhFKoum1o3LxDVDKUvhxSQrCdTdVl7o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=gHi2s8mi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="gHi2s8mi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A849C4CECE; Tue, 15 Oct 2024 11:58:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728993486; bh=qeRozlmTzf3NmxCs8AvsieegKaackQdpX8kBdUBX/jA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gHi2s8miwMBqx9IZzE2CvPmx4xIAMVfs+ynA9Er0vpCVgdFi8dB0tWcf0FxgSg7hT 7vmIHRgDYS1LD+RVmA9ji61POiUuSQTD2f0c5THQM85KXgOESjI3bVhx0NKMveru1Z Taz7AQ26u97++fAQTqkK3mwWYTyLiRyZpbO3/Ajo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ido Schimmel , Guillaume Nault , Paolo Abeni , Sasha Levin Subject: [PATCH 5.15 427/691] ipv4: Mask upper DSCP bits and ECN bits in NETLINK_FIB_LOOKUP family Date: Tue, 15 Oct 2024 13:26:15 +0200 Message-ID: <20241015112457.291256115@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241015112440.309539031@linuxfoundation.org> References: <20241015112440.309539031@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ido Schimmel [ Upstream commit 8fed54758cd248cd311a2b5c1e180abef1866237 ] The NETLINK_FIB_LOOKUP netlink family can be used to perform a FIB lookup according to user provided parameters and communicate the result back to user space. However, unlike other users of the FIB lookup API, the upper DSCP bits and the ECN bits of the DS field are not masked, which can result in the wrong result being returned. Solve this by masking the upper DSCP bits and the ECN bits using IPTOS_RT_MASK. The structure that communicates the request and the response is not exported to user space, so it is unlikely that this netlink family is actually in use [1]. [1] https://lore.kernel.org/netdev/ZpqpB8vJU%2FQ6LSqa@debian/ Signed-off-by: Ido Schimmel Reviewed-by: Guillaume Nault Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/ipv4/fib_frontend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index c21d57f02c651..5ca9c8f1610a7 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -1332,7 +1332,7 @@ static void nl_fib_lookup(struct net *net, struct fib_result_nl *frn) struct flowi4 fl4 = { .flowi4_mark = frn->fl_mark, .daddr = frn->fl_addr, - .flowi4_tos = frn->fl_tos, + .flowi4_tos = frn->fl_tos & IPTOS_RT_MASK, .flowi4_scope = frn->fl_scope, }; struct fib_table *tb; -- 2.43.0