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 24F7A454E9 for ; Tue, 25 Jun 2024 02:02:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 201484275D; Tue, 25 Jun 2024 02:02:02 +0200 (CEST) Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by mails.dpdk.org (Postfix) with ESMTP id E9C4440EDD for ; Tue, 25 Jun 2024 02:02:00 +0200 (CEST) Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-363bbd51050so3903832f8f.0 for ; Mon, 24 Jun 2024 17:02:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719273720; x=1719878520; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NpkX7dNqEavQrbdIFxNWNBZhQlWP5q9zhTlSFmdsYSI=; b=JfphCzYicFIJNj7Ksu3j1wVVOvgfqHf8Ys/egpd5DT/Ws6+aH+Nk/woqXbjnfsBL2u 4MNBqQPLlOFG5aHMi65wf/AzeriHlc1GfvTCFMYNbHQZx/5etTSuR6ZbV+O+8Br1mXE+ XeRoFapdYba3BjFQYnKYdlmNJTobQvpAxaTPfJPDJIwdbRj+ofww0VttRr/v0Z8M46no jhKIX4l6e1mNVXliJVNcftxHKd/R5LjYPZWbzG/HGR8l5nowt63eJ5T2dSzM7Q3khoHB bIgBoc3xRzgXYeQxe5/J0+fw0Lyv5IAi/QscRIGT9+VmcbZ/6uXKgWy9vsZr8V4sJY4e plUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719273720; x=1719878520; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NpkX7dNqEavQrbdIFxNWNBZhQlWP5q9zhTlSFmdsYSI=; b=lPtyWwENDm39tf3FuT4/bZxBW0NQUS7iTQw6d1PWGLTWUj5bNdnce63w/FjOsPw3Br 0/rT8AX1y0bF1HtKHyATw3eHvMWwetHX3xYHO/inTXQYsK7ktNgkiby/94Qtfhy70lXn 4v4T5y0wwdqGQWvCWNL82+u4+lTLmdPiqFMQSUY32xoTibL2u/oFx+1f3/lvdbvqcMuN VaqzGlBqkVH9pecQG9iRWW+RXCqVuzVO7fz1hYj2a2Gx6HIrGAkpTYmHPtT3u2GNUWaU aZqxzKkG7sJ22K1J68s3CmuEoioqtcqQs3BDkb8W+13J5gvRKsU+HRB8odLIqsfywuDw ZfSA== X-Forwarded-Encrypted: i=1; AJvYcCVySurz70hF4U1P4MGBEt0dOLkET2CH7/CEzK+5aAWL5ddwPmN0j8rs/j6IYCjqqWvdJS2+T3sb1wCdiCZopCI= X-Gm-Message-State: AOJu0YyeZGaeEnW9t+HveQNZaHauhY+1lv/RD5htKj1CKUyhyv9ZSlBS QUTd/IN7aBbh4lOGsKOHOts1t7CydHiC9YjRVkK7kOv51aqYqADcT9/kiQ== X-Google-Smtp-Source: AGHT+IEhLm6xwK7FLMJKk1gmj4VfnuIquiylvaOISakus512dzaLS4vdcD9cW96EhGOcaf4yHFPURQ== X-Received: by 2002:adf:eb89:0:b0:364:a04a:93b2 with SMTP id ffacd0b85a97d-366e4ed2cd6mr4518365f8f.15.1719273720411; Mon, 24 Jun 2024 17:02:00 -0700 (PDT) Received: from localhost ([2a01:4b00:d036:ae00:7aef:1aaa:3dff:d546]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4247d0c54c9sm192703825e9.27.2024.06.24.17.01.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 17:01:59 -0700 (PDT) From: luca.boccassi@gmail.com To: Julien Meunier Cc: Bruce Richardson , dpdk stable Subject: patch 'net/fm10k: fix cleanup during init failure' has been queued to stable release 22.11.6 Date: Tue, 25 Jun 2024 00:58:37 +0100 Message-Id: <20240624235907.885628-51-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240624235907.885628-1-luca.boccassi@gmail.com> References: <20240624235907.885628-1-luca.boccassi@gmail.com> MIME-Version: 1.0 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 22.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/27/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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/f461c249ff19a1744dea7c2ab117fa6872e1d606 Thanks. Luca Boccassi --- >From f461c249ff19a1744dea7c2ab117fa6872e1d606 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 8b83063f0a..a4e06a0cfa 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -3055,7 +3055,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private); 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; PMD_INIT_FUNC_TRACE(); @@ -3144,21 +3144,24 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) diag = fm10k_stats_reset(dev); if (diag != 0) { PMD_INIT_LOG(ERR, "Stats reset failed: %d", diag); - return diag; + ret = diag; + goto err_stat; } /* Reset the hw */ diag = fm10k_reset_hw(hw); if (diag != FM10K_SUCCESS) { PMD_INIT_LOG(ERR, "Hardware reset failed: %d", diag); - return -EIO; + ret = -EIO; + goto err_reset_hw; } /* Setup mailbox service */ diag = fm10k_setup_mbx_service(hw); if (diag != FM10K_SUCCESS) { PMD_INIT_LOG(ERR, "Failed to setup mailbox: %d", diag); - return -EIO; + ret = -EIO; + goto err_mbx; } /*PF/VF has different interrupt handling mechanism */ @@ -3197,7 +3200,8 @@ 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; } } @@ -3232,7 +3236,8 @@ 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; } } @@ -3241,6 +3246,28 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) MAIN_VSI_POOL_NUMBER); 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; } static int -- 2.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-06-25 00:22:16.503503953 +0100 +++ 0051-net-fm10k-fix-cleanup-during-init-failure.patch 2024-06-25 00:22:13.185185649 +0100 @@ -1 +1 @@ -From cd7f5da2e7d647863a3d6552b6787f413bbd05f2 Mon Sep 17 00:00:00 2001 +From f461c249ff19a1744dea7c2ab117fa6872e1d606 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 8b83063f0a..a4e06a0cfa 100644 @@ -26 +27 @@ -@@ -3058,7 +3058,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) +@@ -3055,7 +3055,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) @@ -35 +36 @@ -@@ -3147,21 +3147,24 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) +@@ -3144,21 +3144,24 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) @@ -63 +64 @@ -@@ -3200,7 +3203,8 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) +@@ -3197,7 +3200,8 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) @@ -73 +74 @@ -@@ -3235,7 +3239,8 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) +@@ -3232,7 +3236,8 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) @@ -83 +84 @@ -@@ -3244,6 +3249,28 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) +@@ -3241,6 +3246,28 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)