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 4CC3A45DB9 for ; Wed, 27 Nov 2024 18:20:07 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4691E402DE; Wed, 27 Nov 2024 18:20:07 +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 3455B402DE for ; Wed, 27 Nov 2024 18:20:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732728004; 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=Kd4gbhG4erVOYs61Ggm5Myo+vVzOkm7ebuJGiPQCtk8=; b=fWlwwfEBvLBSVzdGYITragwRRpHsK1d1OTZTJsUrVpxUpIXuCKQYfh9qfa9DUDY78B7woc FzrJ97MydVawuBAR5gngz2p8YE2gehHcxFIlaiksVqTey6qxqzARt/0J6NH2FLqD6TI0LJ 5pMGgEVt0lnhUw3czHreSezVZvORx2U= Received: from mx-prod-mc-03.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-248-MoOdpmBHOf6PTMq4xGBHeA-1; Wed, 27 Nov 2024 12:20:01 -0500 X-MC-Unique: MoOdpmBHOf6PTMq4xGBHeA-1 X-Mimecast-MFC-AGG-ID: MoOdpmBHOf6PTMq4xGBHeA 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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E73D419560BD; Wed, 27 Nov 2024 17:19:58 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.192.52]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5EC0F300019E; Wed, 27 Nov 2024 17:19:55 +0000 (UTC) From: Kevin Traynor To: Stephen Hemminger Cc: Ivan Malov , Andrew Rybchenko , =?UTF-8?q?Morten=20Br=C3=B8rup?= , Konstantin Ananyev , Wathsala Vithanage , dpdk stable Subject: patch 'net/sfc: fix use after free in debug logs' has been queued to stable release 21.11.9 Date: Wed, 27 Nov 2024 17:17:20 +0000 Message-ID: <20241127171916.690404-13-ktraynor@redhat.com> In-Reply-To: <20241127171916.690404-1-ktraynor@redhat.com> References: <20241127171916.690404-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: N4XC5Pd4EbCRv3EGsX180vzenCaJqk_j3IUfv-yEnyo_1732727999 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 21.11.9 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 12/02/24. 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/c9e55a5817d6b66954476defc0e945169be059e8 Thanks. Kevin --- >From c9e55a5817d6b66954476defc0e945169be059e8 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 8 Oct 2024 09:47:13 -0700 Subject: [PATCH] net/sfc: fix use after free in debug logs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ upstream commit 757b0b6f207c072a550f43836856235aa41553ad ] If compiler detection of use-after-free is enabled then this drivers debug messages will cause warnings. Change to move debug message before the object is freed. Bugzilla ID: 1551 Fixes: 55c1238246d5 ("net/sfc: add more debug messages to transfer flows") Signed-off-by: Stephen Hemminger Reviewed-by: Ivan Malov Acked-by: Andrew Rybchenko Acked-by: Morten Brørup Acked-by: Konstantin Ananyev Acked-by: Wathsala Vithanage --- drivers/net/sfc/sfc_mae.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c index eb97524dc3..3d98d4dba8 100644 --- a/drivers/net/sfc/sfc_mae.c +++ b/drivers/net/sfc/sfc_mae.c @@ -422,7 +422,6 @@ sfc_mae_outer_rule_del(struct sfc_adapter *sa, TAILQ_REMOVE(&mae->outer_rules, rule, entries); - rte_free(rule); - sfc_dbg(sa, "deleted outer_rule=%p", rule); + rte_free(rule); } @@ -583,7 +582,6 @@ sfc_mae_mac_addr_del(struct sfc_adapter *sa, struct sfc_mae_mac_addr *mac_addr) TAILQ_REMOVE(&mae->mac_addrs, mac_addr, entries); - rte_free(mac_addr); - sfc_dbg(sa, "deleted mac_addr=%p", mac_addr); + rte_free(mac_addr); } @@ -780,8 +778,8 @@ sfc_mae_encap_header_del(struct sfc_adapter *sa, TAILQ_REMOVE(&mae->encap_headers, encap_header, entries); + sfc_dbg(sa, "deleted encap_header=%p", encap_header); + rte_free(encap_header->buf); rte_free(encap_header); - - sfc_dbg(sa, "deleted encap_header=%p", encap_header); } @@ -1086,7 +1084,6 @@ sfc_mae_action_set_del(struct sfc_adapter *sa, } TAILQ_REMOVE(&mae->action_sets, action_set, entries); - rte_free(action_set); - sfc_dbg(sa, "deleted action_set=%p", action_set); + rte_free(action_set); } -- 2.47.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-11-27 17:17:38.739827222 +0000 +++ 0013-net-sfc-fix-use-after-free-in-debug-logs.patch 2024-11-27 17:17:38.170269088 +0000 @@ -1 +1 @@ -From 757b0b6f207c072a550f43836856235aa41553ad Mon Sep 17 00:00:00 2001 +From c9e55a5817d6b66954476defc0e945169be059e8 Mon Sep 17 00:00:00 2001 @@ -8,0 +9,2 @@ +[ upstream commit 757b0b6f207c072a550f43836856235aa41553ad ] + @@ -15 +16,0 @@ -Cc: stable@dpdk.org @@ -24,3 +25,2 @@ - drivers/net/sfc/sfc_flow_rss.c | 4 ++-- - drivers/net/sfc/sfc_mae.c | 25 ++++++++++--------------- - 2 files changed, 12 insertions(+), 17 deletions(-) + drivers/net/sfc/sfc_mae.c | 13 +++++-------- + 1 file changed, 5 insertions(+), 8 deletions(-) @@ -28,14 +27,0 @@ -diff --git a/drivers/net/sfc/sfc_flow_rss.c b/drivers/net/sfc/sfc_flow_rss.c -index e28c943335..8e2749833b 100644 ---- a/drivers/net/sfc/sfc_flow_rss.c -+++ b/drivers/net/sfc/sfc_flow_rss.c -@@ -304,7 +304,7 @@ sfc_flow_rss_ctx_del(struct sfc_adapter *sa, struct sfc_flow_rss_ctx *ctx) - TAILQ_REMOVE(&flow_rss->ctx_list, ctx, entries); - rte_free(ctx->qid_offsets); -- rte_free(ctx); -- - sfc_dbg(sa, "flow-rss: deleted ctx=%p", ctx); -+ -+ rte_free(ctx); - } - @@ -43 +29 @@ -index 60ff6d2181..8f74f10390 100644 +index eb97524dc3..3d98d4dba8 100644 @@ -46 +32 @@ -@@ -401,7 +401,6 @@ sfc_mae_outer_rule_del(struct sfc_adapter *sa, +@@ -422,7 +422,6 @@ sfc_mae_outer_rule_del(struct sfc_adapter *sa, @@ -55 +41 @@ -@@ -586,7 +585,6 @@ sfc_mae_mac_addr_del(struct sfc_adapter *sa, struct sfc_mae_mac_addr *mac_addr) +@@ -583,7 +582,6 @@ sfc_mae_mac_addr_del(struct sfc_adapter *sa, struct sfc_mae_mac_addr *mac_addr) @@ -64 +50 @@ -@@ -786,8 +784,8 @@ sfc_mae_encap_header_del(struct sfc_adapter *sa, +@@ -780,8 +778,8 @@ sfc_mae_encap_header_del(struct sfc_adapter *sa, @@ -67,4 +53 @@ -- rte_free(encap_header->buf); -- rte_free(encap_header); -- - sfc_dbg(sa, "deleted encap_header=%p", encap_header); ++ sfc_dbg(sa, "deleted encap_header=%p", encap_header); @@ -72,8 +55,2 @@ -+ rte_free(encap_header->buf); -+ rte_free(encap_header); - } - -@@ -984,7 +982,6 @@ sfc_mae_counter_del(struct sfc_adapter *sa, struct sfc_mae_counter *counter) - - TAILQ_REMOVE(&mae->counters, counter, entries); -- rte_free(counter); + rte_free(encap_header->buf); + rte_free(encap_header); @@ -81,2 +58 @@ - sfc_dbg(sa, "deleted counter=%p", counter); -+ rte_free(counter); +- sfc_dbg(sa, "deleted encap_header=%p", encap_header); @@ -85,2 +61,2 @@ -@@ -1166,7 +1163,6 @@ sfc_mae_action_set_del(struct sfc_adapter *sa, - sfc_mae_counter_del(sa, action_set->counter); +@@ -1086,7 +1084,6 @@ sfc_mae_action_set_del(struct sfc_adapter *sa, + } @@ -92,20 +67,0 @@ - } - -@@ -1402,8 +1398,8 @@ sfc_mae_action_set_list_del(struct sfc_adapter *sa, - - TAILQ_REMOVE(&mae->action_set_lists, action_set_list, entries); -+ sfc_dbg(sa, "deleted action_set_list=%p", action_set_list); -+ - rte_free(action_set_list->action_sets); - rte_free(action_set_list); -- -- sfc_dbg(sa, "deleted action_set_list=%p", action_set_list); - } - -@@ -1668,7 +1664,6 @@ sfc_mae_action_rule_del(struct sfc_adapter *sa, - - TAILQ_REMOVE(&mae->action_rules, rule, entries); -- rte_free(rule); -- - sfc_dbg(sa, "deleted action_rule=%p", rule); -+ rte_free(rule);