From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 831BDA04DD for ; Wed, 28 Oct 2020 11:54:53 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7E7FFCA68; Wed, 28 Oct 2020 11:54:52 +0100 (CET) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by dpdk.org (Postfix) with ESMTP id A8DF1CA68 for ; Wed, 28 Oct 2020 11:54:49 +0100 (CET) Received: by mail-wr1-f67.google.com with SMTP id t9so5134254wrq.11 for ; Wed, 28 Oct 2020 03:54:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=to4adXvP5qa8WjeBf+1P4qnkkghOThMKrgMfdoR22x8=; b=SOxYErSds3bu82K7Wx1xHbLrhQE7ZvQUmnNtZqTNFAdNSuHzDlSqsrhobYz4/CgNBu yEGHisM4IcuxYGvX0rPZsk5tCwH94KOm5wqwSs9A+qyf3WqgGZup7sGQp8OlVvyn4sJw UzoHqaFrUus3HET+hIxA4wUah6qce9ONZKBSMrTrDsKVA94wscmiMGBAWZCJfKI0moPu WJ7GL0Q4WPBgloK9Ztr7P3Em7TQMsLnpi134HMoVBcYJ4yBzTGUUtJINrcvZoNZ0YVYI JP7Ixazwk7onmhLUKZvcfopR9KGQFt7KitCntOTwi5wAErnMKEHhmCVVUzyx2LWUam9M E0zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=to4adXvP5qa8WjeBf+1P4qnkkghOThMKrgMfdoR22x8=; b=JycaIy7/CMucCVrCzzcg1ZyfzrTKpR/eXd77YkpJEt8V2ZJs24V+Qh1v/E2tG5U7eP Dbl7v1uAz/YXX3bNj1goKisUkM6+UMYkg3fB2lgdv4LO1y9utUFa6JQc3nWsaDQ40rhC xM9GpbkPjUTCAudC0Tu+w6wavlzuJgQTr8icq+DNWk3VyDY+HYn5l6tqvuqYIKZqhti/ ZZhi+BI3kG7V72hQW/Q0fSdmn9HV2s7FQMdl+rd0t1qppn60i37HR2pMigopxWgmJWzG BKHvWw3qHxteqVMhXtLpClOLMXJM7yBD5UjHahKh4zbpwdTXZ6RSPYpPERlWoIvjeSU9 vskA== X-Gm-Message-State: AOAM533xOuqZ7cPgoGEeHvUdADh1Yh3xdLW0PQAdMvwlCMarFghw2Flg cPDQnQUlu0ykyA9W5qMuKthZddlgjYUV0H5R X-Google-Smtp-Source: ABdhPJypOpn85/z915d0cxZvGA/VBtGgoMJQYxCwEBmLqUaSVsCkT40WrWEdbX3PtKSGR3x+kx5Qlg== X-Received: by 2002:adf:ea0b:: with SMTP id q11mr6739938wrm.80.1603882489430; Wed, 28 Oct 2020 03:54:49 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id t19sm5687170wmj.42.2020.10.28.03.54.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 03:54:48 -0700 (PDT) From: luca.boccassi@gmail.com To: Yunjian Wang Cc: Long Li , dpdk stable Date: Wed, 28 Oct 2020 10:45:23 +0000 Message-Id: <20201028104606.3504127-164-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201028104606.3504127-1-luca.boccassi@gmail.com> References: <20201028104606.3504127-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/netvsc: fix Tx queue leak in error path' has been queued to stable release 19.11.6 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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 Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.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 10/30/20. 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. Thanks. Luca Boccassi --- >From 81bb7d7c3ef7d0355d78ac31ff4f8b228facfa7e Mon Sep 17 00:00:00 2001 From: Yunjian Wang Date: Wed, 7 Oct 2020 10:06:25 +0800 Subject: [PATCH] net/netvsc: fix Tx queue leak in error path [ upstream commit f3013acfc17b8920b97223421976f3b3bb32489a ] In hn_dev_tx_queue_setup() allocated memory for txq, we don't free it when error happens and it will lead to memory leak. We can check for tx_free_thresh at the beginning of the function to fix it, before calling txq = rte_zmalloc_socket(). Fixes: cc0251813277 ("net/netvsc: split send buffers from Tx descriptors") Signed-off-by: Yunjian Wang Acked-by: Long Li --- drivers/net/netvsc/hn_rxtx.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c index 90ec8d7d57..460f1bc57f 100644 --- a/drivers/net/netvsc/hn_rxtx.c +++ b/drivers/net/netvsc/hn_rxtx.c @@ -252,16 +252,6 @@ hn_dev_tx_queue_setup(struct rte_eth_dev *dev, PMD_INIT_FUNC_TRACE(); - txq = rte_zmalloc_socket("HN_TXQ", sizeof(*txq), RTE_CACHE_LINE_SIZE, - socket_id); - if (!txq) - return -ENOMEM; - - txq->hv = hv; - txq->chan = hv->channels[queue_idx]; - txq->port_id = dev->data->port_id; - txq->queue_id = queue_idx; - tx_free_thresh = tx_conf->tx_free_thresh; if (tx_free_thresh == 0) tx_free_thresh = RTE_MIN(nb_desc / 4, @@ -276,6 +266,15 @@ hn_dev_tx_queue_setup(struct rte_eth_dev *dev, return -EINVAL; } + txq = rte_zmalloc_socket("HN_TXQ", sizeof(*txq), RTE_CACHE_LINE_SIZE, + socket_id); + if (!txq) + return -ENOMEM; + + txq->hv = hv; + txq->chan = hv->channels[queue_idx]; + txq->port_id = dev->data->port_id; + txq->queue_id = queue_idx; txq->free_thresh = tx_free_thresh; snprintf(name, sizeof(name), -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-10-28 10:35:16.817761445 +0000 +++ 0164-net-netvsc-fix-Tx-queue-leak-in-error-path.patch 2020-10-28 10:35:11.764833851 +0000 @@ -1,8 +1,10 @@ -From f3013acfc17b8920b97223421976f3b3bb32489a Mon Sep 17 00:00:00 2001 +From 81bb7d7c3ef7d0355d78ac31ff4f8b228facfa7e Mon Sep 17 00:00:00 2001 From: Yunjian Wang Date: Wed, 7 Oct 2020 10:06:25 +0800 Subject: [PATCH] net/netvsc: fix Tx queue leak in error path +[ upstream commit f3013acfc17b8920b97223421976f3b3bb32489a ] + In hn_dev_tx_queue_setup() allocated memory for txq, we don't free it when error happens and it will lead to memory leak. @@ -10,7 +12,6 @@ fix it, before calling txq = rte_zmalloc_socket(). Fixes: cc0251813277 ("net/netvsc: split send buffers from Tx descriptors") -Cc: stable@dpdk.org Signed-off-by: Yunjian Wang Acked-by: Long Li @@ -19,7 +20,7 @@ 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c -index 65f1abae51..5d59db513c 100644 +index 90ec8d7d57..460f1bc57f 100644 --- a/drivers/net/netvsc/hn_rxtx.c +++ b/drivers/net/netvsc/hn_rxtx.c @@ -252,16 +252,6 @@ hn_dev_tx_queue_setup(struct rte_eth_dev *dev,