patches for DPDK stable branches
 help / color / mirror / Atom feed
From: "Yunjian Wang" <yunjian.wang@foxmail.com>
To: "'Long Li'" <longli@microsoft.com>,
	"'wangyunjian'" <wangyunjian@huawei.com>, <dev@dpdk.org>
Cc: "'Stephen Hemminger'" <sthemmin@microsoft.com>,
	"'KY Srinivasan'" <kys@microsoft.com>,
	"'Haiyang Zhang'" <haiyangz@microsoft.com>,
	<jerry.lilijun@huawei.com>, <xudingke@huawei.com>,
	<stable@dpdk.org>
Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] net/netvsc: fix txq leak in error path
Date: Fri, 2 Oct 2020 22:25:33 +0800	[thread overview]
Message-ID: <tencent_DF334FEDA0670C8DE72F0E755FF6FC805706@qq.com> (raw)
In-Reply-To: <BN8PR21MB1155E1836E060C721EC16443CE330@BN8PR21MB1155.namprd21.prod.outlook.com>

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Long Li
> Sent: Thursday, October 1, 2020 6:27 AM
> To: wangyunjian <wangyunjian@huawei.com>; dev@dpdk.org
> Cc: Stephen Hemminger <sthemmin@microsoft.com>; KY Srinivasan
> <kys@microsoft.com>; Haiyang Zhang <haiyangz@microsoft.com>;
> jerry.lilijun@huawei.com; xudingke@huawei.com; stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] net/netvsc: fix txq leak in error path
> 
> >Subject: [dpdk-dev] [PATCH] net/netvsc: fix txq leak in error path
> >
> >From: Yunjian Wang <wangyunjian@huawei.com>
> >
> >In hn_dev_tx_queue_setup() allocated memory for txq, we should free it
> >when error happens, otherwise it will lead to memory leak.
> >
> >Fixes: cc0251813277 ("net/netvsc: split send buffers from Tx
> >descriptors")
> >Cc: stable@dpdk.org
> >
> >Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> >---
> > drivers/net/netvsc/hn_rxtx.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> >diff --git a/drivers/net/netvsc/hn_rxtx.c
> >b/drivers/net/netvsc/hn_rxtx.c index 65f1abae5..8c94e7ee3 100644
> >--- a/drivers/net/netvsc/hn_rxtx.c
> >+++ b/drivers/net/netvsc/hn_rxtx.c
> >@@ -273,6 +273,7 @@ hn_dev_tx_queue_setup(struct rte_eth_dev *dev,
> > 			     " (tx_free_thresh=%u port=%u queue=%u)\n",
> > 			     nb_desc - 3,
> > 			     tx_free_thresh, dev->data->port_id, queue_idx);
> >+		rte_free(txq);
> > 		return -EINVAL;
> > 	}
> >
> >--
> >2.23.0
> 
> How about checking for tx_free_thresh at the beginning of the function,
> before calling txq = rte_zmalloc_socket()?
> 
> This way, you don't' need to call rte_free() on error.

OK, I will fix it in next version.

Thanks,
Yunjian

> 
> Long


  reply	other threads:[~2020-10-02 14:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-29 13:44 wangyunjian
2020-09-30 22:27 ` Long Li
2020-10-02 14:25   ` Yunjian Wang [this message]
2020-10-07  2:06 ` [dpdk-stable] [dpdk-dev] [PATCH v2] " wangyunjian
2020-10-09  3:53   ` Long Li
2020-10-09 11:36     ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_DF334FEDA0670C8DE72F0E755FF6FC805706@qq.com \
    --to=yunjian.wang@foxmail.com \
    --cc=dev@dpdk.org \
    --cc=haiyangz@microsoft.com \
    --cc=jerry.lilijun@huawei.com \
    --cc=kys@microsoft.com \
    --cc=longli@microsoft.com \
    --cc=stable@dpdk.org \
    --cc=sthemmin@microsoft.com \
    --cc=wangyunjian@huawei.com \
    --cc=xudingke@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).