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 BAC4A428F8 for ; Sun, 9 Apr 2023 17:35:22 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B0E0742BAC; Sun, 9 Apr 2023 17:35:22 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2065.outbound.protection.outlook.com [40.107.92.65]) by mails.dpdk.org (Postfix) with ESMTP id A1ABA427EE for ; Sun, 9 Apr 2023 17:35:21 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c4zlgpFQ6vRhYD+RWAeHAp7o2wU7wJZHKaLKMrFPMojUi8ssa3mYGtak5vXjGJPJOdyjTSsJEhf/pHGdP41gagJSHMeyYjc9R656wjYErIgTPgPjuTeVAY/0f701yEsgHlSgI4UUJ7KhVP1mDNLn/0aQS0yOB7KifLzXKH/Og9Fbg+IhzrCiig4y6nMToHLPgEgxCoGGaMo9Zk0+HbNbPgpyaCCCpD02pdo11fnvVTVKhWGvAARNd6rBSb47jIfwaWP2+J/LDIvq5DMVMikPoiEkyBpS1PVOfxfFVZmCXwu0LVAwFJnqPpkt9RG7e7b/3rIKCaAQuGbs6O14681xxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=P9pvrDetwi9PKiFfXdMuGOk1nQfJgKkxZHgZjozrifY=; b=jJSOLB9cc6nsJ0KOLQZq1r0wPMT9i3kSdf6YPxEdigYfdnxX9p2nZPw31z+9uel4Ax7WMfFppl/mYy3fgGIGFpjBn4j/X6rZMmGrWyFT4NikjR33dH0qDO9sjU7jwnVeZ3eTLdyQFvPI6uuyRDXpOr/KszDmPaV8Iq/fPU4oy+E+VkxlnVvWrpDNdYqdIOBtAbI1M5ZzqQ1hnu8Dw4MKiePml7aCEJRMAejc8AGZb7LnSczEJUj/BJAKEpf1qpnW+MZ6su10Faq2ccOlylG5PycJmhlV93K+RPCS231UcBMM1FzLzYy4xbpt4bZFUIRk4HOsBbAO1IN7FODzYxIM6A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=redhat.com 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 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=P9pvrDetwi9PKiFfXdMuGOk1nQfJgKkxZHgZjozrifY=; b=hq0059WhpBEY4FCKZ/H+dF0W62hZbdwKqGnTMkjQz4rouH90v04gvUzMnb9DxQkrGqT4AUlRbDMLGVqwmwd7nFwUcYpEVyi/X8KwaYobGFJApkvU3J5nZg1m9OigX/2/agkPotrqD/CeIuCpICXrdRE6CEGXFlwcGrJ3pe8taeNwAzAPcCyH7wJ+Snx2VQkKgmrNIeFKER3NMx6FpltsYPXI9u74yJ+RmTcyzUL/hNjRAUbonbD6384r/UAANfdEpd/RpRYdg7WGGMRmo+Dh51QuwgF67rqUXBl8hD3s2q5QL54Jr0zdWDRJlGYvBAJgUGpuCgLPzu3+XDvjVkNURQ== Received: from BN9PR03CA0339.namprd03.prod.outlook.com (2603:10b6:408:f6::14) by PH7PR12MB7377.namprd12.prod.outlook.com (2603:10b6:510:20c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.30; Sun, 9 Apr 2023 15:35:18 +0000 Received: from BN8NAM11FT088.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f6:cafe::d4) by BN9PR03CA0339.outlook.office365.com (2603:10b6:408:f6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.34 via Frontend Transport; Sun, 9 Apr 2023 15:35:17 +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 BN8NAM11FT088.mail.protection.outlook.com (10.13.177.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.25 via Frontend Transport; Sun, 9 Apr 2023 15:35:16 +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.986.5; Sun, 9 Apr 2023 08:35:08 -0700 Received: from nvidia.com (10.126.230.37) 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.986.37; Sun, 9 Apr 2023 08:35:06 -0700 From: Xueming Li To: David Marchand CC: Chenbo Xia , dpdk stable Subject: patch 'net/vhost: fix leak in interrupt handle setup' has been queued to stable release 22.11.2 Date: Sun, 9 Apr 2023 23:24:58 +0800 Message-ID: <20230409152529.5308-111-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230409152529.5308-1-xuemingl@nvidia.com> References: <20230227062349.13764-1-xuemingl@nvidia.com> <20230409152529.5308-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.37] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT088:EE_|PH7PR12MB7377:EE_ X-MS-Office365-Filtering-Correlation-Id: 77d739a7-8278-47c3-0658-08db39100528 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pHnr4pQPkSyd4SfbJz8flxTMAqidxeOXqbm63CRa/DhmaWxU8yGKS8iq3SZoATB1LseAub5xxbFS2YRSwh9ttZqMQAhaYPv2HrHCnJ3nf3HGqetfRpuVoU1c2uepeo/aHfQ2GnbEH5pMHpb28T9kfmxLyFigFmLJD5p1idrDRf061useFZ/xhBUkgPhRTVxOYczRbBlPfjGRJrZ9aDtECcsiPxENtQX29axc2mDqLL+LZ8R0eq/kfCjpyO9/WbMs3JXhQsh40UuYoAu6j7huIcOf4I4bo/j3r15e4ta4BV+wy9Tt1NrS/AXwtVm4tDcmp09vNxnZZV6sQcgtQPaLQNd74AH5mFEF/jzp5maR9z2voyo7OS8OQuGGSHsLSrXm2d8pOjzp3LJtOu1mDb4VnaeJlqsXA//9WabET9clLvuFHHgnDOX7p/DoyIxw+O1I8RNi321UibFbdmvoZE1/03uQgCWNEEVr6RD0SdVi1hje6OUAC6RSYL3ND7S6RV+YbPk9ikhpyzzLLEL+nPsQTjILfNhhAz2tfXI4jOWRLamfIDGG2/0CcjudntQUXI9nGUHuF2HSE3qVxKZiW7GxidRN1Ssg6v/Yd5BRvO2ggb5O+aox8rMa0knAoW3ScURD/KuGs9riGb3Maj3uQewu39IVKaXFyEnAtPt4Yhlidi4onEC92SYVAys4n2y0u/o88niHjqfyQ61K3geQH3eY/dWfs6Ri2/a4QBejeyadCDJIeBUjuqAaLvh0bZpFfRcVw4SVihlZanc9EdRiYh8dY9L8nIq2j6ZiDeOX7jBqEydLeG6bElg9cFSWHbl6D/Cz3QkxQm0vX+JJrMftvVbC2w== 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:(13230028)(4636009)(136003)(39860400002)(396003)(376002)(346002)(451199021)(40470700004)(46966006)(36840700001)(54906003)(7696005)(40460700003)(70206006)(70586007)(4326008)(8676002)(6916009)(36756003)(82740400003)(356005)(16526019)(8936002)(6666004)(26005)(186003)(6286002)(7636003)(86362001)(82310400005)(1076003)(41300700001)(316002)(53546011)(2616005)(5660300002)(55016003)(2906002)(36860700001)(47076005)(40480700001)(966005)(426003)(83380400001)(478600001)(336012); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2023 15:35:16.9795 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 77d739a7-8278-47c3-0658-08db39100528 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: BN8NAM11FT088.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7377 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.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 04/11/23. 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=22.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging/commit/1ecf04df54f5ed0743bee50b3498c1a18639a4f2 Thanks. Xueming Li --- >From 1ecf04df54f5ed0743bee50b3498c1a18639a4f2 Mon Sep 17 00:00:00 2001 From: David Marchand Date: Thu, 9 Mar 2023 13:37:51 +0100 Subject: [PATCH] net/vhost: fix leak in interrupt handle setup Cc: Xueming Li [ upstream commit 24c3a04e16aeab45719cf038d2371ccf8d1bc780 ] Do a systematic cleanup if any part of the interrupt handle setup fails. Fixes: d61138d4f0e2 ("drivers: remove direct access to interrupt handle") Signed-off-by: David Marchand Reviewed-by: Chenbo Xia --- drivers/net/vhost/rte_eth_vhost.c | 53 ++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index e8b0ed4f0b..96598f710d 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -686,25 +686,32 @@ eth_vhost_install_intr(struct rte_eth_dev *dev) dev->intr_handle = rte_intr_instance_alloc(RTE_INTR_INSTANCE_F_PRIVATE); if (dev->intr_handle == NULL) { VHOST_LOG(ERR, "Fail to allocate intr_handle\n"); - return -ENOMEM; + ret = -ENOMEM; + goto error; + } + if (rte_intr_efd_counter_size_set(dev->intr_handle, sizeof(uint64_t))) { + ret = -rte_errno; + goto error; } - if (rte_intr_efd_counter_size_set(dev->intr_handle, sizeof(uint64_t))) - return -rte_errno; if (rte_intr_vec_list_alloc(dev->intr_handle, NULL, nb_rxq)) { - VHOST_LOG(ERR, - "Failed to allocate memory for interrupt vector\n"); - rte_intr_instance_free(dev->intr_handle); - return -ENOMEM; + VHOST_LOG(ERR, "Failed to allocate memory for interrupt vector\n"); + ret = -ENOMEM; + goto error; } VHOST_LOG(INFO, "Prepare intr vec\n"); for (i = 0; i < nb_rxq; i++) { - if (rte_intr_vec_list_index_set(dev->intr_handle, i, RTE_INTR_VEC_RXTX_OFFSET + i)) - return -rte_errno; - if (rte_intr_efds_index_set(dev->intr_handle, i, -1)) - return -rte_errno; + if (rte_intr_vec_list_index_set(dev->intr_handle, i, + RTE_INTR_VEC_RXTX_OFFSET + i)) { + ret = -rte_errno; + goto error; + } + if (rte_intr_efds_index_set(dev->intr_handle, i, -1)) { + ret = -rte_errno; + goto error; + } vq = dev->data->rx_queues[i]; if (!vq) { VHOST_LOG(INFO, "rxq-%d not setup yet, skip!\n", i); @@ -729,16 +736,24 @@ eth_vhost_install_intr(struct rte_eth_dev *dev) VHOST_LOG(INFO, "Installed intr vec for rxq-%d\n", i); } - if (rte_intr_nb_efd_set(dev->intr_handle, nb_rxq)) - return -rte_errno; - - if (rte_intr_max_intr_set(dev->intr_handle, nb_rxq + 1)) - return -rte_errno; - - if (rte_intr_type_set(dev->intr_handle, RTE_INTR_HANDLE_VDEV)) - return -rte_errno; + if (rte_intr_nb_efd_set(dev->intr_handle, nb_rxq)) { + ret = -rte_errno; + goto error; + } + if (rte_intr_max_intr_set(dev->intr_handle, nb_rxq + 1)) { + ret = -rte_errno; + goto error; + } + if (rte_intr_type_set(dev->intr_handle, RTE_INTR_HANDLE_VDEV)) { + ret = -rte_errno; + goto error; + } return 0; + +error: + eth_vhost_uninstall_intr(dev); + return ret; } static void -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-04-09 21:45:41.598189800 +0800 +++ 0110-net-vhost-fix-leak-in-interrupt-handle-setup.patch 2023-04-09 21:45:38.769042200 +0800 @@ -1 +1 @@ -From 24c3a04e16aeab45719cf038d2371ccf8d1bc780 Mon Sep 17 00:00:00 2001 +From 1ecf04df54f5ed0743bee50b3498c1a18639a4f2 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 24c3a04e16aeab45719cf038d2371ccf8d1bc780 ] @@ -9 +11,0 @@ -Cc: stable@dpdk.org @@ -18 +20 @@ -index 198bf4d1f4..96deb18d91 100644 +index e8b0ed4f0b..96598f710d 100644