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 47AAE1ABEA6; Mon, 14 Oct 2024 15:14:20 +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=1728918860; cv=none; b=J3sgpwNqrSzwcvm4EfKN1uZbezUeslwhUliV5X0tDeEqLlmxrZR6aG1V7jSQtxncUw0JuOzuw8cvl5XGgYNTQ9dS65djCQsmyKVON8+9VIf9HOEJ4BOnyXqOk7AIDOb0X0MclHGAMMMs2w8m69cIH33apzXTJwP/YNo8WrI5rNA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728918860; c=relaxed/simple; bh=Sy6E6BUZ8t5FH0fwlpWZQSg0ta9Q4YbtIQBylBCnVFs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ksXDhXCDc6MZmXV7ziG1XAuqofsSIqbAvz/8Ubput9CMo5OtE6TlA0XG2kpvVOFIzofFBpFBvV/wqpEy5MljKzVP3B0rMgKLnkkq5dtU9NZ7OtCWRi4diA7aZv84sVrAgnHHkk1uo4QQEUZGDLfNz4bewDpD69Zn6iJSaJ4dWUU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=qkpV+NbC; 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="qkpV+NbC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7828BC4CEC3; Mon, 14 Oct 2024 15:14:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728918860; bh=Sy6E6BUZ8t5FH0fwlpWZQSg0ta9Q4YbtIQBylBCnVFs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qkpV+NbCVSDC4zZR9PD7al0LdAuAkpCLF7fgqPvxmLzBQ2sbTbMasoQiLoqgIxwXL L3fqj72xW8lfGogbR3ccKopzj//+RMxCeIje66TveFNtiDdxFrq61wmBsEBSxrNBze MaPbcXJHC94Yz2zBJKDNI/cpl23y+iM7NL1iGtKw= 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 6.1 444/798] ipv4: Mask upper DSCP bits and ECN bits in NETLINK_FIB_LOOKUP family Date: Mon, 14 Oct 2024 16:16:38 +0200 Message-ID: <20241014141235.415047310@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241014141217.941104064@linuxfoundation.org> References: <20241014141217.941104064@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-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 390f4be7f7bec..90ce87ffed461 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -1343,7 +1343,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