All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alexandre Cassen" <acassen@corp.free.fr>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH net-next 06/10] net/sched: cls_flower: add enc_key_id mask
Date: Tue, 10 Nov 2026 13:11:02 +0000	[thread overview]
Message-ID: <sashiko-outbox-207095@kernel.org> (raw)
In-Reply-To: <20261109131039.959438-7-acassen@corp.free.fr>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] net/sched: cls_flower: 24-bit VNI mask truncation in
  fl_set_key() offload
--

commit 3a83a862ed7b57be4e00c4d6825ecaf80ce19865
Author: Alexandre Cassen <acassen@corp.free.fr>

net/sched: cls_flower: add enc_key_id mask

This commit adds TCA_FLOWER_KEY_ENC_KEY_ID_MASK so flower filters can match
tunnel keys with an optional 32-bit mask instead of only exact matches.

> diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
> index 23eba4a00a947..dd248a335402a 100644
> --- a/net/sched/cls_flower.c
> +++ b/net/sched/cls_flower.c

[ ... ]

> @@ -2110,7 +2111,7 @@ static int fl_set_key(struct net *net, struct nlattr *tca_opts,
>  	}
>  
>  	fl_set_key_val(tb, &key->enc_key_id.keyid, TCA_FLOWER_KEY_ENC_KEY_ID,
> -		       &mask->enc_key_id.keyid, TCA_FLOWER_UNSPEC,
> +		       &mask->enc_key_id.keyid, TCA_FLOWER_KEY_ENC_KEY_ID_MASK,
>  		       sizeof(key->enc_key_id.keyid));

[Severity: Medium]
Can a filter with a 24-bit key and a mask that only has bits 24..31 set (such
as enc_key_id 0x0/0xff000000) truncate the hardware VNI mask to zero in cxgb4
and mlx5?

Commit "cxgb4: flower: refuse a tunnel key wider than the VNI" and commit
"net/mlx5e: TC, refuse a tunnel key wider than the VNI" only check that
match.key->keyid fits in 24 bits, so key 0 with mask 0xff000000 passes
validation.  In cxgb4, truncating match.mask->keyid to the 24-bit fs->mask.vni
field yields 0 and skips setting encap_vld, programming a rule that matches
non-encapsulated traffic on the port:

drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c:cxgb4_process_flow_match() {
	...
		fs->val.vni = be32_to_cpu(match.key->keyid);
		fs->mask.vni = be32_to_cpu(match.mask->keyid);
		if (fs->mask.vni) {
			fs->val.encap_vld = 1;
			fs->mask.encap_vld = 1;
		}
	...
}

In mlx5e_tc_tun_parse_vxlan(), enc_keyid.mask->keyid is non-zero, so it
truncates the 24-bit vxlan_vni mask in misc_c to 0 while still setting
MLX5_MATCH_MISC_PARAMETERS in spec->match_criteria_enable.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261109131039.959438-1-acassen@corp.free.fr?part=6

  reply	other threads:[~2026-11-10 13:11 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 13:10 [PATCH net-next 00/10] tc flower: tunnel key partitioning for RX queue steering Alexandre Cassen
2026-11-09 13:10 ` [PATCH net-next 01/10] bnxt_en: require an exact tunnel id in TC flows Alexandre Cassen
2026-11-10 13:10   ` sashiko-bot
2026-11-09 13:10 ` [PATCH net-next 02/10] cxgb4: flower: refuse a tunnel key wider than the VNI Alexandre Cassen
2026-11-10 13:10   ` sashiko-bot
2026-11-11 19:11   ` netdev-bot+sashiko
2026-11-09 13:10 ` [PATCH net-next 03/10] nfp: " Alexandre Cassen
2026-11-10 13:11   ` sashiko-bot
2026-11-11 19:12   ` netdev-bot+sashiko
2026-11-09 13:10 ` [PATCH net-next 04/10] net/mlx5e: TC, " Alexandre Cassen
2026-11-10 13:11   ` sashiko-bot
2026-11-11 19:12   ` netdev-bot+sashiko
2026-11-09 13:10 ` [PATCH net-next 05/10] net/mlx5e: TC, reject a partial tunnel key with tunnel mapping Alexandre Cassen
2026-11-10 13:11   ` sashiko-bot
2026-11-11 19:12   ` netdev-bot+sashiko
2026-11-09 13:10 ` [PATCH net-next 06/10] net/sched: cls_flower: add enc_key_id mask Alexandre Cassen
2026-11-10 13:11   ` sashiko-bot [this message]
2026-11-11 19:12   ` netdev-bot+sashiko
2026-11-09 13:10 ` [PATCH net-next 07/10] selftests: forwarding: tc_flower: test the " Alexandre Cassen
2026-11-10 13:11   ` sashiko-bot
2026-11-11 19:12   ` netdev-bot+sashiko
2026-11-09 13:10 ` [PATCH net-next 08/10] net/mlx5e: TC, offload RX queue mapping in NIC flows Alexandre Cassen
2026-11-10 13:11   ` sashiko-bot
2026-11-11 19:12   ` netdev-bot+sashiko
2026-11-09 13:10 ` [PATCH net-next 09/10] net/mlx5e: TC, match the tunnel key without a tunnel device Alexandre Cassen
2026-11-10 13:11   ` sashiko-bot
2026-11-11 19:12   ` netdev-bot+sashiko
2026-11-09 13:10 ` [PATCH net-next 10/10] docs: networking: describe tunnel key partitioning in TC queue filtering Alexandre Cassen
2026-11-10 13:11   ` sashiko-bot
2026-11-11 19:12   ` netdev-bot+sashiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-207095@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=acassen@corp.free.fr \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.