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 C74981DF266; Wed, 6 Nov 2024 12:14:24 +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=1730895264; cv=none; b=c/pEvcXDxvcM/ZaWSL8XYUCBY9rLotsFarvl0TiBuNkOjuoxH92xxSuFYqQTnF1RVOiQtCPuiD7hNmTf2btuNo4Qg2S9BgsllatrgTHA8Q8HajxTZKbsFi6kNvCkNUGsocrN+xtCpi+/qXZCDu1JY98vPGPd8932geynOT7kbOI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730895264; c=relaxed/simple; bh=N7Xjmg1adJZ91szriL9wQv0UXrZfRtBA3RtyqQMprJs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZMl8bLo7/dp4ys8Gdn5vzs06HDDWRy2YSowHhEGFNS2Cfp/olRhjCOrO08KuWakwEPJz5H7UsP97YRVuFAwKV/KoIBO8co21gOICSJCDXBKECvBelMzO4Mn/EXClRmgssV1vLZsNVHO9Nf/MQcAxO8pmNttkviZG8PewGJeGou8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=yY2y4pt3; 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="yY2y4pt3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F62BC4CECD; Wed, 6 Nov 2024 12:14:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1730895264; bh=N7Xjmg1adJZ91szriL9wQv0UXrZfRtBA3RtyqQMprJs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yY2y4pt3LXS3aLgEwXpnOMTP9jGOXWcUYiszI1dFh/Wzl3FuP5yJd2aJ4WACTmth3 nxEd7y5v8sQQL2EvPOFTJf18QDV95nO9ZYp3BptlkGzs21+Ccj+LU8KbT+S0goe065 QukwUK0Yd96m+cwgO1ELHCRYtPuJgahAIu4HVIiQ= 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 4.19 158/350] ipv4: Mask upper DSCP bits and ECN bits in NETLINK_FIB_LOOKUP family Date: Wed, 6 Nov 2024 13:01:26 +0100 Message-ID: <20241106120324.823310014@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241106120320.865793091@linuxfoundation.org> References: <20241106120320.865793091@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 4.19-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 9aa48b4c40960..322ba1ba2ac3b 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -1135,7 +1135,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