From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 F3BBB31F98D; Sat, 30 May 2026 18:09:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780164568; cv=none; b=A2VLR4oJML/daHHDvmcUpNvIajyFYrQ5q8XQdMMkzMTS1wtvJ+eFCL6GnWQwWXUUR+xmmvB7rMK1vt3MN9fM3pMnmg3OEj5OTKoHWDRjzijc2BiQ6t5TrQvRKX6VUro6qM8RqVowPI6Lsu7t64NuOfAH0JPfZ57yxLoYRdTOsxw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780164568; c=relaxed/simple; bh=ofciWMdzVc50FZWt2AIbswuKk8sbvgsAr39A+glQHfk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QpUBDWa4ZGZ5p0v7czzxXfmORo9G7War9mCmxiXgyf+2TVPeugHtHYRSgV9LI9sJUs5Tz7bbxtFxKI4Qiap4Q2b5fnWxHKaAKSUm4//oQ64ssVkfvSQpRwOoq6F30UlSwMFvLNYPYi7ouW4ykBqH8tswgfyqn9YRNIXKNQgGQDo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=C/QzXBI5; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="C/QzXBI5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CE7B1F00893; Sat, 30 May 2026 18:09:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780164567; bh=sFyrgkF8gNcEwb009dVASUQo+ZHmMAOjPGGJUaSEXTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=C/QzXBI5yAkYHx9r3AKmY7wRdTQ7NYSvd7ZBPOEt5Je6nSt4Dg3AH3I6mElydb4DP zd1j2LZCSeY8WZJUlW/tt4JNVynX7mUoMignh/Jq6ENULvjbgd4xhrameoLiT/jeiJ xB1PpOiHD3x2CRGqAJe3vpeKSDssCPTMsa8pjz8Q= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dudu Lu , =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Paolo Abeni , Sasha Levin Subject: [PATCH 5.15 554/776] net/sched: sch_cake: fix NAT destination port not being updated in cake_update_flowkeys Date: Sat, 30 May 2026 18:04:28 +0200 Message-ID: <20260530160254.466888247@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160240.228940103@linuxfoundation.org> References: <20260530160240.228940103@linuxfoundation.org> User-Agent: quilt/0.69 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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dudu Lu [ Upstream commit f9e40664706927d7ae22a448a3383e23c38a4c0b ] cake_update_flowkeys() is supposed to update the flow dissector keys with the NAT-translated addresses and ports from conntrack, so that CAKE's per-flow fairness correctly identifies post-NAT flows as belonging to the same connection. For the source port, this works correctly: keys->ports.src = port; But for the destination port, the assignment is reversed: port = keys->ports.dst; This means the NAT destination port is never updated in the flow keys. As a result, when multiple connections are NATed to the same destination, CAKE treats them as separate flows because the original (pre-NAT) destination ports differ. This breaks CAKE's NAT-aware flow isolation when using the "nat" mode. The bug was introduced in commit b0c19ed6088a ("sch_cake: Take advantage of skb->hash where appropriate") which refactored the original direct assignment into a compare-and-conditionally-update pattern, but wrote the destination port update backwards. Fix by reversing the assignment direction to match the source port pattern. Fixes: b0c19ed6088a ("sch_cake: Take advantage of skb->hash where appropriate") Signed-off-by: Dudu Lu Acked-by: Toke Høiland-Jørgensen Link: https://patch.msgid.link/20260413110041.44704-1-phx0fer@gmail.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/sched/sch_cake.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c index cfeda7b50cc2e..87578d05a0925 100644 --- a/net/sched/sch_cake.c +++ b/net/sched/sch_cake.c @@ -619,7 +619,7 @@ static bool cake_update_flowkeys(struct flow_keys *keys, } port = rev ? tuple.src.u.all : tuple.dst.u.all; if (port != keys->ports.dst) { - port = keys->ports.dst; + keys->ports.dst = port; upd = true; } } -- 2.53.0