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 B6FB0427EF for ; Wed, 22 Mar 2023 11:32:34 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B3CB842B71; Wed, 22 Mar 2023 11:32:34 +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 AF2ED42B71 for ; Wed, 22 Mar 2023 11:32:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679481153; 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=SbfZoxnE88p0rpJhjsKHVCLHrt6HEwRfKn4FDd0+fZk=; b=T4lakLH+o2TNDUgMdFa7gtF7NKstpURdXFJIWq/LNYBDC6wcKb2Zjv6baZR/livzOJpFnq lBG9HSaJBK24OWgkeXmIC21O/JQClWLLgl0496UkRV7UwAn7wwlnrJRPlDfosg47qhGgSY 0nQhqdVjvKbVN16PzN0SOXGdM+smxek= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-182-4dc9FfHyOCm0KJna1DjYhg-1; Wed, 22 Mar 2023 06:32:32 -0400 X-MC-Unique: 4dc9FfHyOCm0KJna1DjYhg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EDD353C10682; Wed, 22 Mar 2023 10:32:31 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.192.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1708B492C13; Wed, 22 Mar 2023 10:32:30 +0000 (UTC) From: Kevin Traynor To: David Marchand Cc: Chenbo Xia , dpdk stable Subject: patch 'net/vhost: fix leak in interrupt handle setup' has been queued to stable release 21.11.4 Date: Wed, 22 Mar 2023 10:31:57 +0000 Message-Id: <20230322103209.456098-10-ktraynor@redhat.com> In-Reply-To: <20230322103209.456098-1-ktraynor@redhat.com> References: <20230322103209.456098-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/24/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://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/a38b2e569315d093d9dd58ed572ca3951319d419 Thanks. Kevin --- >From a38b2e569315d093d9dd58ed572ca3951319d419 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 [ 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 ad2d52475d..31ff871bbc 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -661,14 +661,16 @@ eth_vhost_install_intr(struct rte_eth_dev *dev) 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; } @@ -676,8 +678,13 @@ eth_vhost_install_intr(struct rte_eth_dev *dev) 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) { @@ -704,14 +711,22 @@ eth_vhost_install_intr(struct rte_eth_dev *dev) } - 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; } -- 2.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-03-22 10:30:08.180116749 +0000 +++ 0010-net-vhost-fix-leak-in-interrupt-handle-setup.patch 2023-03-22 10:30:07.911866560 +0000 @@ -1 +1 @@ -From 24c3a04e16aeab45719cf038d2371ccf8d1bc780 Mon Sep 17 00:00:00 2001 +From a38b2e569315d093d9dd58ed572ca3951319d419 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 24c3a04e16aeab45719cf038d2371ccf8d1bc780 ] + @@ -9 +10,0 @@ -Cc: stable@dpdk.org @@ -18 +19 @@ -index 198bf4d1f4..96deb18d91 100644 +index ad2d52475d..31ff871bbc 100644 @@ -21 +22 @@ -@@ -687,14 +687,16 @@ eth_vhost_install_intr(struct rte_eth_dev *dev) +@@ -661,14 +661,16 @@ eth_vhost_install_intr(struct rte_eth_dev *dev) @@ -45 +46 @@ -@@ -702,8 +704,13 @@ eth_vhost_install_intr(struct rte_eth_dev *dev) +@@ -676,8 +678,13 @@ eth_vhost_install_intr(struct rte_eth_dev *dev) @@ -63 +64 @@ -@@ -730,14 +737,22 @@ eth_vhost_install_intr(struct rte_eth_dev *dev) +@@ -704,14 +711,22 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)