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 C662545804 for ; Fri, 23 Aug 2024 18:21:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C0FEF402BE; Fri, 23 Aug 2024 18:21:08 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 846CF40295 for ; Fri, 23 Aug 2024 18:21:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724430067; 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=k0BQAcPJyYL96WqjdM3b6Ljlk5pInIwTztKyjQce4WU=; b=CR7PY2xFLioEeYNCkJwMaXoLZZpxN7JV6yqiLFCkKDerCdpMHt7xClY7NAKlaK2CG3Hz+6 0gVhHi9SfOCQuFYIJos67NqN+x/s5KRjuDhvYmkutR0PpPqdqhO3nNc/DLhlFYfv3uSpek asDPEmAvbam8W56eEFEyyyytdepLfLw= Received: from mx-prod-mc-01.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-605-LK9GXRFtN9iht64KqvMoFw-1; Fri, 23 Aug 2024 12:21:05 -0400 X-MC-Unique: LK9GXRFtN9iht64KqvMoFw-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8F8E91955BF6; Fri, 23 Aug 2024 16:21:02 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.193.224]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F3FA71956053; Fri, 23 Aug 2024 16:21:00 +0000 (UTC) From: Kevin Traynor To: Julien Meunier Cc: Bruce Richardson , dpdk stable Subject: patch 'net/fm10k: fix cleanup during init failure' has been queued to stable release 21.11.8 Date: Fri, 23 Aug 2024 17:17:47 +0100 Message-ID: <20240823161929.1004778-39-ktraynor@redhat.com> In-Reply-To: <20240823161929.1004778-1-ktraynor@redhat.com> References: <20240823161929.1004778-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 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 21.11.8 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 08/28/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/7a97a44a0a9d65856f26499c092fcb05e51f16f1 Thanks. Kevin --- >From 7a97a44a0a9d65856f26499c092fcb05e51f16f1 Mon Sep 17 00:00:00 2001 From: Julien Meunier Date: Wed, 3 Apr 2024 13:55:41 +0200 Subject: [PATCH] net/fm10k: fix cleanup during init failure [ upstream commit cd7f5da2e7d647863a3d6552b6787f413bbd05f2 ] Cleanup was not done on this PMD if a error is seen during the init: - possible memory leak due to a missing free - interrupt handler was not disabled: if an IRQ is received after the init, a SIGSEGV can be seen (private data stored in rte_eth_devices[port_id] is pointing to NULL) Fixes: a6061d9e7075 ("fm10k: register PF driver") Fixes: 4c287332c39a ("fm10k: add PF and VF interrupt handling") Signed-off-by: Julien Meunier Reviewed-by: Bruce Richardson --- drivers/net/fm10k/fm10k_ethdev.c | 39 +++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 8bbd8b445d..5bac1794fb 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -3057,5 +3057,5 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) struct rte_pci_device *pdev = RTE_ETH_DEV_TO_PCI(dev); struct rte_intr_handle *intr_handle = pdev->intr_handle; - int diag, i; + int diag, i, ret; struct fm10k_macvlan_filter_info *macvlan; @@ -3146,5 +3146,6 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) if (diag != 0) { PMD_INIT_LOG(ERR, "Stats reset failed: %d", diag); - return diag; + ret = diag; + goto err_stat; } @@ -3153,5 +3154,6 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) if (diag != FM10K_SUCCESS) { PMD_INIT_LOG(ERR, "Hardware reset failed: %d", diag); - return -EIO; + ret = -EIO; + goto err_reset_hw; } @@ -3160,5 +3162,6 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) if (diag != FM10K_SUCCESS) { PMD_INIT_LOG(ERR, "Failed to setup mailbox: %d", diag); - return -EIO; + ret = -EIO; + goto err_mbx; } @@ -3199,5 +3202,6 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) if (switch_ready == false) { PMD_INIT_LOG(ERR, "switch is not ready"); - return -1; + ret = -1; + goto err_switch_ready; } } @@ -3234,5 +3238,6 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) if (!hw->mac.default_vid) { PMD_INIT_LOG(ERR, "default VID is not ready"); - return -1; + ret = -1; + goto err_vid; } } @@ -3243,4 +3248,26 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) return 0; + +err_vid: +err_switch_ready: + rte_intr_disable(intr_handle); + + if (hw->mac.type == fm10k_mac_pf) { + fm10k_dev_disable_intr_pf(dev); + rte_intr_callback_unregister(intr_handle, + fm10k_dev_interrupt_handler_pf, (void *)dev); + } else { + fm10k_dev_disable_intr_vf(dev); + rte_intr_callback_unregister(intr_handle, + fm10k_dev_interrupt_handler_vf, (void *)dev); + } + +err_mbx: +err_reset_hw: +err_stat: + rte_free(dev->data->mac_addrs); + dev->data->mac_addrs = NULL; + + return ret; } -- 2.46.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-08-23 17:18:11.104916685 +0100 +++ 0039-net-fm10k-fix-cleanup-during-init-failure.patch 2024-08-23 17:18:09.681429969 +0100 @@ -1 +1 @@ -From cd7f5da2e7d647863a3d6552b6787f413bbd05f2 Mon Sep 17 00:00:00 2001 +From 7a97a44a0a9d65856f26499c092fcb05e51f16f1 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit cd7f5da2e7d647863a3d6552b6787f413bbd05f2 ] + @@ -14 +15,0 @@ -Cc: stable@dpdk.org @@ -23 +24 @@ -index fa0d16277e..7b490bea17 100644 +index 8bbd8b445d..5bac1794fb 100644 @@ -26 +27 @@ -@@ -3059,5 +3059,5 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) +@@ -3057,5 +3057,5 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) @@ -33 +34 @@ -@@ -3148,5 +3148,6 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) +@@ -3146,5 +3146,6 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) @@ -41 +42 @@ -@@ -3155,5 +3156,6 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) +@@ -3153,5 +3154,6 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) @@ -49 +50 @@ -@@ -3162,5 +3164,6 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) +@@ -3160,5 +3162,6 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) @@ -57 +58 @@ -@@ -3201,5 +3204,6 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) +@@ -3199,5 +3202,6 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) @@ -65 +66 @@ -@@ -3236,5 +3240,6 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) +@@ -3234,5 +3238,6 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) @@ -73 +74 @@ -@@ -3245,4 +3250,26 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) +@@ -3243,4 +3248,26 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)