[PATCH] net/mlx5/hws: fix null dereference in rule skip
Shani Peretz
shperetz at nvidia.com
Wed Jan 21 09:18:22 CET 2026
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 at dpdk.org
Signed-off-by: Shani Peretz <shperetz at nvidia.com>
Acked-by: Bing Zhao <bingz at 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
More information about the stable
mailing list