From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D0D5448B69 for ; Fri, 21 Nov 2025 12:24:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CBC614026F; Fri, 21 Nov 2025 12:24:52 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 547D0402E0 for ; Fri, 21 Nov 2025 12:24:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763724290; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KZmKySlso7osR5OW94U2m8gjuMms01xl1sO7JqAYg68=; b=g1qYHIHNtyi+4X5aLnKKE4wUfrSv4M8+Tl2g7gybKWKoK9tuWQm/L8HxdSchOts5qfD/zm 2gpw4omIhn+OZss/JuZYZFCqcvoCs+7uGgH6Wu4iq+VMmuzpfJtyyNKW0cN6F6BeQgxIMl gDIdMvD+ZJMKWwww0XzLmy8/VPJyiSY= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-60--4kErTMtNgKIP-Mv9dLSlQ-1; Fri, 21 Nov 2025 06:24:45 -0500 X-MC-Unique: -4kErTMtNgKIP-Mv9dLSlQ-1 X-Mimecast-MFC-AGG-ID: -4kErTMtNgKIP-Mv9dLSlQ_1763724284 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8CCAD1956095; Fri, 21 Nov 2025 11:24:44 +0000 (UTC) Received: from rh.redhat.com (unknown [10.42.28.165]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3582730044DB; Fri, 21 Nov 2025 11:24:42 +0000 (UTC) From: Kevin Traynor To: Shani Peretz Cc: Dariusz Sosnowski , dpdk stable Subject: patch 'net/mlx5: fix null dereference in modify header' has been queued to stable release 24.11.4 Date: Fri, 21 Nov 2025 11:21:17 +0000 Message-ID: <20251121112128.485623-93-ktraynor@redhat.com> In-Reply-To: <20251121112128.485623-1-ktraynor@redhat.com> References: <20251121112128.485623-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: ytlIhQw0N7RBvp2l5QIgmom_M0K0R0t9_U-384JIbqQ_1763724284 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 24.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/26/25. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/c484fbc1034dcbe6b127121839a84b5b16899ce0 Thanks. Kevin --- >From c484fbc1034dcbe6b127121839a84b5b16899ce0 Mon Sep 17 00:00:00 2001 From: Shani Peretz Date: Sun, 16 Nov 2025 14:10:26 +0200 Subject: [PATCH] net/mlx5: fix null dereference in modify header [ upstream commit df19cf4aa720935a31edcb2954a88cfd038880e6 ] GCC analyzer identified a code path where acts->mhdr could be NULL when dereferenced. When modify header validation fails in mlx5_tbl_translate_modify_header(), __flow_hw_action_template_destroy() sets acts->mhdr to NULL. Add defensive NULL check in mlx5_tbl_ensure_shared_modify_header() to prevent the dereference. Bugzilla ID: 1521 Fixes: 12f2ed3f03c8 ("net/mlx5: set modify header as shared flow action") Signed-off-by: Shani Peretz Acked-by: Dariusz Sosnowski --- drivers/net/mlx5/mlx5_flow_hw.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index e4a67a0c1a..11ea9ae152 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -2303,7 +2303,8 @@ mlx5_tbl_translate_modify_header(struct rte_eth_dev *dev, }; - if (flow_hw_validate_compiled_modify_field(dev, cfg, mhdr, error)) { + int ret = flow_hw_validate_compiled_modify_field(dev, cfg, mhdr, error); + if (ret) { __flow_hw_action_template_destroy(dev, acts); - return -rte_errno; + return ret; } acts->mhdr = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*acts->mhdr), @@ -2336,7 +2337,12 @@ mlx5_tbl_ensure_shared_modify_header(struct rte_eth_dev *dev, const struct rte_flow_attr *attr = &table_attr->flow_attr; enum mlx5dr_table_type tbl_type = get_mlx5dr_table_type(attr); - struct mlx5dr_action_mh_pattern pattern = { - .sz = sizeof(struct mlx5_modification_cmd) * acts->mhdr->mhdr_cmds_num - }; + struct mlx5dr_action_mh_pattern pattern; + + if (!acts->mhdr) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, + "translate modify_header: mhdr is NULL"); + + pattern.sz = sizeof(struct mlx5_modification_cmd) * acts->mhdr->mhdr_cmds_num; uint16_t mhdr_ix = acts->mhdr->pos; uint32_t flags = mlx5_hw_act_flag[!!attr->group][tbl_type] | MLX5DR_ACTION_FLAG_SHARED; -- 2.51.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-11-21 11:05:12.452936311 +0000 +++ 0093-net-mlx5-fix-null-dereference-in-modify-header.patch 2025-11-21 11:05:09.619201835 +0000 @@ -1 +1 @@ -From df19cf4aa720935a31edcb2954a88cfd038880e6 Mon Sep 17 00:00:00 2001 +From c484fbc1034dcbe6b127121839a84b5b16899ce0 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit df19cf4aa720935a31edcb2954a88cfd038880e6 ] + @@ -15 +16,0 @@ -Cc: stable@dpdk.org @@ -24 +25 @@ -index 3b015ec9a0..2695d047c7 100644 +index e4a67a0c1a..11ea9ae152 100644 @@ -27 +28 @@ -@@ -2337,7 +2337,8 @@ mlx5_tbl_translate_modify_header(struct rte_eth_dev *dev, +@@ -2303,7 +2303,8 @@ mlx5_tbl_translate_modify_header(struct rte_eth_dev *dev, @@ -38,3 +39,3 @@ -@@ -2372,7 +2373,12 @@ mlx5_tbl_ensure_shared_modify_header(struct rte_eth_dev *dev, - enum mlx5dr_table_type tbl_type = get_mlx5dr_table_type(attr, table_attr->specialize, - unified_fdb); +@@ -2336,7 +2337,12 @@ mlx5_tbl_ensure_shared_modify_header(struct rte_eth_dev *dev, + const struct rte_flow_attr *attr = &table_attr->flow_attr; + enum mlx5dr_table_type tbl_type = get_mlx5dr_table_type(attr);