From: sashiko-bot@kernel.org
To: "Alexandre Cassen" <acassen@corp.free.fr>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH net] net/mlx5: HWS, fix action STE double free on rule update
Date: Tue, 24 Nov 2026 22:13:33 +0000 [thread overview]
Message-ID: <sashiko-outbox-232095@kernel.org> (raw)
In-Reply-To: <20261123221310.4045513-1-acassen@corp.free.fr>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] net/mlx5: HWS, missing rollback on update alloc error in
hws_rule_create_hws()
- [Medium] net/mlx5: HWS, leak of old_action_ste on rule deletion after
failed update
--
commit 0a380355d2aec6e9f92b8c556ecd839808dbe0cd
Author: Alexandre Cassen <acassen@corp.free.fr>
net/mlx5: HWS, fix action STE double free on rule update
This commit clears rule->action_ste.action_tbl after saving rule->action_ste
to rule->old_action_ste during a rule update so that rules updated to need
no action STEs do not free the old chunk twice.
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/rule.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/rule.c
> index 0d4cb2b2393b9..cc94d3149d76a 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/rule.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/rule.c
> @@ -243,6 +243,8 @@ static void hws_rule_create_init(struct mlx5hws_rule *rule,
> * new action STEs and a corresponding match STE.
> */
> rule->old_action_ste = rule->action_ste;
> + /* The rule may need no action STEs once updated */
> + rule->action_ste.action_tbl = NULL;
> }
>
> rule->pending_wqes = 0;
[Severity: Medium]
Does hws_rule_create_hws() leave the rule stuck in
MLX5HWS_RULE_STATUS_UPDATING and leak rule->old_action_ste if
mlx5hws_rule_alloc_action_ste() fails during an update?
hws_rule_create_init() sets rule->status to MLX5HWS_RULE_STATUS_UPDATING,
moves rule->action_ste to rule->old_action_ste, and clears
rule->action_ste.action_tbl before hws_rule_create_hws() calls
mlx5hws_rule_alloc_action_ste():
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/rule.c:hws_rule_create_hws() {
...
if (action_stes) {
ret = mlx5hws_rule_alloc_action_ste(rule, attr->queue_id,
!!ste_attr.rtc_0,
!!ste_attr.rtc_1);
if (ret) {
mlx5hws_err(ctx, "Failed to allocate action memory %d", ret);
mlx5hws_send_abort_new_dep_wqe(queue);
return ret;
}
}
...
}
Because no WQE is posted on that error return, no completion transitions
rule->status out of MLX5HWS_RULE_STATUS_UPDATING. Later update and
destroy calls fail with -EBUSY, and mlx5hws_bwc_rule_destroy() frees the
rule object while leaking rule->old_action_ste, rule->resize_info, and the
hardware match STE.
[Severity: Medium]
Can clearing rule->action_ste.action_tbl here also leak
rule->old_action_ste when a rule is deleted after an asynchronous update
failure?
If an update WQE fails while either rule->rtc_0 or rule->rtc_1 remains
non-zero, hws_send_engine_update_rule() leaves rule->status at
MLX5HWS_RULE_STATUS_FAILING rather than MLX5HWS_RULE_STATUS_FAILED. When
the rule is later deleted, both the MLX5HWS_RULE_STATUS_DELETED completion
in hws_send_engine_update_rule() and the skip_delete path in
hws_rule_destroy_hws() only call
mlx5hws_rule_free_action_ste(&rule->action_ste), leaving
rule->old_action_ste leaked in the action STE pool even when the failed
update needed no new action STEs.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261123221310.4045513-1-acassen@corp.free.fr?part=1
next prev parent reply other threads:[~2026-11-24 22:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 22:13 [PATCH net] net/mlx5: HWS, fix action STE double free on rule update Alexandre Cassen
2026-11-24 12:09 ` Yevgeny Kliteynik
2026-11-24 22:13 ` sashiko-bot [this message]
2026-11-24 22:47 ` 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-232095@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox