diff options
author | Toke Høiland-Jørgensen <toke@redhat.com> | 2021-08-16 14:59:17 +0300 |
---|---|---|
committer | Sasha Levin <sashal@kernel.org> | 2021-08-26 15:35:49 +0300 |
commit | df61235881c8d331fa6ac0b91d4591f7030d6adf (patch) | |
tree | a1003e37626c97465cf6ea0390e1d30a7714dcbd | |
parent | e1ec5858bae13e5529626566c1b0ff742b97ebbe (diff) | |
download | linux-df61235881c8d331fa6ac0b91d4591f7030d6adf.tar.xz |
sch_cake: fix srchost/dsthost hashing mode
[ Upstream commit 86b9bbd332d0510679c7fedcee3e3bd278be5756 ]
When adding support for using the skb->hash value as the flow hash in CAKE,
I accidentally introduced a logic error that broke the host-only isolation
modes of CAKE (srchost and dsthost keywords). Specifically, the flow_hash
variable should stay initialised to 0 in cake_hash() in pure host-based
hashing mode. Add a check for this before using the skb->hash value as
flow_hash.
Fixes: b0c19ed6088a ("sch_cake: Take advantage of skb->hash where appropriate")
Reported-by: Pete Heist <pete@heistp.net>
Tested-by: Pete Heist <pete@heistp.net>
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | net/sched/sch_cake.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c index 5c15968b5155..c2c37ffd94f2 100644 --- a/net/sched/sch_cake.c +++ b/net/sched/sch_cake.c @@ -720,7 +720,7 @@ static u32 cake_hash(struct cake_tin_data *q, const struct sk_buff *skb, skip_hash: if (flow_override) flow_hash = flow_override - 1; - else if (use_skbhash) + else if (use_skbhash && (flow_mode & CAKE_FLOW_FLOWS)) flow_hash = skb->hash; if (host_override) { dsthost_hash = host_override - 1; |