* [PATCH] net/mlx5/hws: fix null dereference in rule skip
@ 2026-01-21 8:18 Shani Peretz
2026-02-08 14:15 ` Raslan Darawsheh
0 siblings, 1 reply; 2+ messages in thread
From: Shani Peretz @ 2026-01-21 8:18 UTC (permalink / raw)
To: dev
Cc: rasland, Shani Peretz, stable, Bing Zhao, Dariusz Sosnowski,
Viacheslav Ovsiienko, Ori Kam, Suanming Mou, Matan Azrad,
Erez Shitrit, Alex Vesker
When using template API with a represented_port pattern item that
has no spec, mlx5dr_rule_skip() dereferences a NULL pointer when
accessing v->port_id.
Now validating the spec before accessing port_id.
Fixes: 405242c52dd5 ("net/mlx5/hws: add rule object")
Cc: stable@dpdk.org
Signed-off-by: Shani Peretz <shperetz@nvidia.com>
Acked-by: Bing Zhao <bingz@nvidia.com>
---
drivers/net/mlx5/hws/mlx5dr_rule.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/mlx5/hws/mlx5dr_rule.c b/drivers/net/mlx5/hws/mlx5dr_rule.c
index 895ac858ec..23327d2b73 100644
--- a/drivers/net/mlx5/hws/mlx5dr_rule.c
+++ b/drivers/net/mlx5/hws/mlx5dr_rule.c
@@ -38,6 +38,10 @@ static void mlx5dr_rule_skip(struct mlx5dr_matcher *matcher,
if (mt->item_flags & MLX5_FLOW_ITEM_REPRESENTED_PORT) {
v = items[mt->vport_item_id].spec;
+ if (unlikely(!v)) {
+ DR_LOG(NOTICE, "Fail to get vport item, ignoring");
+ return;
+ }
vport = flow_hw_conv_port_id(matcher->tbl->ctx, v->port_id);
if (unlikely(!vport)) {
DR_LOG(ERR, "Fail to map port ID %d, ignoring", v->port_id);
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net/mlx5/hws: fix null dereference in rule skip
2026-01-21 8:18 [PATCH] net/mlx5/hws: fix null dereference in rule skip Shani Peretz
@ 2026-02-08 14:15 ` Raslan Darawsheh
0 siblings, 0 replies; 2+ messages in thread
From: Raslan Darawsheh @ 2026-02-08 14:15 UTC (permalink / raw)
To: Shani Peretz, dev
Cc: stable, Bing Zhao, Dariusz Sosnowski, Viacheslav Ovsiienko,
Ori Kam, Suanming Mou, Matan Azrad, Erez Shitrit, Alex Vesker
Hi,
On 21/01/2026 10:18 AM, Shani Peretz wrote:
> When using template API with a represented_port pattern item that
> has no spec, mlx5dr_rule_skip() dereferences a NULL pointer when
> accessing v->port_id.
>
> Now validating the spec before accessing port_id.
>
> Fixes: 405242c52dd5 ("net/mlx5/hws: add rule object")
> Cc: stable@dpdk.org
>
> Signed-off-by: Shani Peretz <shperetz@nvidia.com>
> Acked-by: Bing Zhao <bingz@nvidia.com>
Patch applied to next-net-mlx,
Kindest regards
Raslan Darawsheh
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-08 14:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-21 8:18 [PATCH] net/mlx5/hws: fix null dereference in rule skip Shani Peretz
2026-02-08 14:15 ` Raslan Darawsheh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox