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 0235F45CE3 for ; Mon, 11 Nov 2024 07:31:48 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E86DD4067A; Mon, 11 Nov 2024 07:31:47 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2068.outbound.protection.outlook.com [40.107.93.68]) by mails.dpdk.org (Postfix) with ESMTP id 398994067A for ; Mon, 11 Nov 2024 07:31:46 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=C40+Wo48h4U//88GjYoPgRaCDf0sOZUnYPWnzg8oN+Tek6u9T2lTUGU/S4YZn++ukdD5JmpcK6rpBDqzw+X105X0THzeWypg3cjiaITXVscURK45tq1Ch5Nps8VaB4K8KzfeXZVj8tG5CBrkhgswlyM/JJaFakF8n5cHo/Ysndcr0lzu5vBRWAXPW7PhP2I0uFePw8fUceAK6bm4IlVpMkVE38NPPTOmuERUFfKwmT8eUabOumHX7BJ8OpGg0EGbYNZ1oQPN731hm7DgX3Tt9g7Bca3P+8pSdrpSLRGO37bSVe1nP0eZEcfw3UUHeihY3CTCI1UYAGr0vIN5xfBd1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YxYOU+ssqoUrtYCJOOVaoZEXqq3fvAgrxZRg0FNsDBc=; b=CEpIUgyHyx51OOQwGPKI5ntoTtjnKJGGWBp/0wzwph2R5e3ZUFy08AloQKAJ8jVS4IabeIpo1604EMjrQH9KwTugQqVr6XohdLmnfkYrB6ikE/CgZK1iUvNIzCKacA6HbU6/Sp/6fHkitzzohY5bW8SRjSSp2DWOx8wOYgevkRLpcZjaDaC74Z6025GExZJo6YGOxNACuPxMqkFKY3DBh9xTaM9zbcXjfcznvotJ/VfFXQ3bN0b2UDkvG3AuYY29YiyVL5oPZlOMKVxxp7Pfv4x07sK+mX4fzWfxJVwR8irPsfgVJA95dsY4nuLvxDus3F18B3KVeUpOabp1FxKpZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=networkplumber.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YxYOU+ssqoUrtYCJOOVaoZEXqq3fvAgrxZRg0FNsDBc=; b=R2VSpzZyTyHTtWlIFrhOb8lRnqXfvk5ls27aqaS6N/OvNZ+XzyZhXri5g/swa3qgntTMXbEjVLul9fFqN9RI9XRSf117PQbdhyI4U8gKy5SWqDnrss/NuIb5E+IYuCFIHNAFCcoRqGnKSmXpPQ14HcJE8ApVKRdd5JsKyDWyM5OHVOvDfxUgmqswLP7wt/FSBZMAMGDVyqqtbe5rwpRrI1hSnvFlfMQ9Id8Zinsy+WHacbK2nxSxwrmJcKwQjctFAhUl8VBjcYBhDuuXDicHH7vY7b2KJNdsOyCyFMb9p76BZ1P/X6Ww1iJY9sqx/+Og3y7wPKxUF5/hVWpdPFSnTw== Received: from DM5PR07CA0115.namprd07.prod.outlook.com (2603:10b6:4:ae::44) by IA1PR12MB7566.namprd12.prod.outlook.com (2603:10b6:208:42e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.27; Mon, 11 Nov 2024 06:31:41 +0000 Received: from DS1PEPF00017091.namprd03.prod.outlook.com (2603:10b6:4:ae:cafe::f4) by DM5PR07CA0115.outlook.office365.com (2603:10b6:4:ae::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.28 via Frontend Transport; Mon, 11 Nov 2024 06:31:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DS1PEPF00017091.mail.protection.outlook.com (10.167.17.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.14 via Frontend Transport; Mon, 11 Nov 2024 06:31:41 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Sun, 10 Nov 2024 22:31:28 -0800 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Sun, 10 Nov 2024 22:31:25 -0800 From: Xueming Li 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 23.11.3 Date: Mon, 11 Nov 2024 14:27:10 +0800 Message-ID: <20241111062847.216344-25-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241111062847.216344-1-xuemingl@nvidia.com> References: <20241111062847.216344-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017091:EE_|IA1PR12MB7566:EE_ X-MS-Office365-Filtering-Correlation-Id: 18f80f98-bb7c-4b35-ad22-08dd021a8128 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?B?akE3Uys2Mkl1dHJxR0Q5OG11YVRiUDhDaXd2T1FMaXZPQkE0dzVuLzAydnFK?= =?utf-8?B?M2pPK2w5eUpmRVdKNUJHOHVVTWdtU0tkczdLOFBJWE9kcjRBTkVUU0lvTzMz?= =?utf-8?B?a0lBYjg3K2xjVlI0eG4wb1l0YzZncEkzcW1BVHlCdWVoVHV0NGVsdGx0KzVv?= =?utf-8?B?bThqZkpyakpIUVNIZTNjbGdVVHhXbTFzZFhZWDcyakVTMDZneExiOUh4ZnNp?= =?utf-8?B?cm5lbEZXRkJHVkxHQXZ6b2l1R1dRcUMvS1ErT0tmM0VxN1JlUUFPM3djQzd6?= =?utf-8?B?Y2YvRTBZSnRHWjQ4SGpzMXJRb2llbTU5TmhyRHFzZkpYeFMrTVFTRDFRTmRo?= =?utf-8?B?bWRRMG5ISzBYQkkwTVJ0WHhPU1FLbUVsV2xEN0V4Zzc2bjUycEVNalkvcEh0?= =?utf-8?B?b0hhTGhiTkViWUxXTFlzWTdsWEgxUThkeUVHMnZjSVpwZk54enRKRnZaODhW?= =?utf-8?B?UDNMU1JDUzZhaTdNV2xoYjRMZEg0RHJwT3pxZUEyYmtjRUF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Vg4ZWpxYkdxME5UVUJXUzIydGhC?= =?utf-8?B?amxqbnBjMEc4bVNhUzNwdzJzcWx3WUVURlQ1NWVTWUcvNDZjZUxoMVVjSVBB?= =?utf-8?B?dFlCUDFPQWJ5SnJPQlRrZmdxSHloR2J1Q1lmTURPZDJnVy95Z0lJajd5SElS?= =?utf-8?B?T1A3T2szVGh4M3hpNlVsUzRQR2tIZ2ZCUXA5WUlRbDEySHdrRXRpTktVeGJl?= =?utf-8?B?bFVXc05mdWlHTW1QckdoUjkzTy80VlhqbFl6YkoxOUIyWUcyK2FENGxaZzda?= =?utf-8?B?Z0EzdWQvNmpzK2xUaDVYTFhyTkdac0UrWHlZVFhmd0FDSitOMEZkZEFJUGhU?= =?utf-8?B?elZsb3czUnN0QUN6bXU2Mi9TNlE2bnhGRTBGVmVORmtIN2tCdjZMeXhiWW54?= =?utf-8?B?MFZTM3NZSGhCQTVNblJsd3R2aXpYTFdZM2RkUm5mWTVjMlZlTUJVdldsdS84?= =?utf-8?B?TlJsQTVEdnhXd3pzdkFwQzNTc0ZVQ1ZNWXAxVWNRUW1XUUE9PQ==?= X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230040)(36860700013)(376014)(82310400026)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2024 06:31:41.4716 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 18f80f98-bb7c-4b35-ad22-08dd021a8128 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF00017091.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7566 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 23.11.3 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/30/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://git.dpdk.org/dpdk-stable/log/?h=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=5a5a90d8fd00b0afb5d50081df1081412c601514 Thanks. Xueming Li --- >From 5a5a90d8fd00b0afb5d50081df1081412c601514 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 Cc: Xueming Li [ 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_flow_rss.c | 4 ++-- drivers/net/sfc/sfc_mae.c | 23 +++++++++-------------- 2 files changed, 11 insertions(+), 16 deletions(-) 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 @@ -303,9 +303,9 @@ 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); } static int diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c index 60ff6d2181..8f74f10390 100644 --- a/drivers/net/sfc/sfc_mae.c +++ b/drivers/net/sfc/sfc_mae.c @@ -400,9 +400,8 @@ sfc_mae_outer_rule_del(struct sfc_adapter *sa, efx_mae_match_spec_fini(sa->nic, rule->match_spec); TAILQ_REMOVE(&mae->outer_rules, rule, entries); - rte_free(rule); - sfc_dbg(sa, "deleted outer_rule=%p", rule); + rte_free(rule); } static int @@ -585,9 +584,8 @@ 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); } enum sfc_mae_mac_addr_type { @@ -785,10 +783,10 @@ 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); } static int @@ -983,9 +981,8 @@ sfc_mae_counter_del(struct sfc_adapter *sa, struct sfc_mae_counter *counter) } TAILQ_REMOVE(&mae->counters, counter, entries); - rte_free(counter); - sfc_dbg(sa, "deleted counter=%p", counter); + rte_free(counter); } static int @@ -1165,9 +1162,8 @@ sfc_mae_action_set_del(struct sfc_adapter *sa, sfc_mae_mac_addr_del(sa, action_set->src_mac_addr); sfc_mae_counter_del(sa, action_set->counter); 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); } static int @@ -1401,10 +1397,10 @@ sfc_mae_action_set_list_del(struct sfc_adapter *sa, sfc_mae_action_set_del(sa, action_set_list->action_sets[i]); 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); } static int @@ -1667,9 +1663,8 @@ sfc_mae_action_rule_del(struct sfc_adapter *sa, sfc_mae_outer_rule_del(sa, rule->outer_rule); TAILQ_REMOVE(&mae->action_rules, rule, entries); - rte_free(rule); - sfc_dbg(sa, "deleted action_rule=%p", rule); + rte_free(rule); } static int -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-11-11 14:23:06.465646112 +0800 +++ 0024-net-sfc-fix-use-after-free-in-debug-logs.patch 2024-11-11 14:23:05.052192841 +0800 @@ -1 +1 @@ -From 757b0b6f207c072a550f43836856235aa41553ad Mon Sep 17 00:00:00 2001 +From 5a5a90d8fd00b0afb5d50081df1081412c601514 Mon Sep 17 00:00:00 2001 @@ -7,0 +8,3 @@ +Cc: Xueming Li + +[ upstream commit 757b0b6f207c072a550f43836856235aa41553ad ] @@ -15 +17,0 @@ -Cc: stable@dpdk.org