DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Yunjian Wang <wangyunjian@huawei.com>,
	dev@dpdk.org, keith.wiles@intel.com
Cc: xudingke@huawei.com, stable@dpdk.org
Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH] net/tap: fix memory leak when unregister intr handler
Date: Mon, 20 Jan 2020 12:43:11 +0000	[thread overview]
Message-ID: <78f8e06b-092b-51e2-677f-358e4f4162c8@intel.com> (raw)
In-Reply-To: <1579509045-18296-1-git-send-email-wangyunjian@huawei.com>

On 1/20/2020 8:30 AM, Yunjian Wang wrote:
> The return check of function tap_lsc_intr_handle_set() is wrong, it should
> be 0 or a positive number if success. So the intr_handle->intr_vec was not
> been freed when tap_lsc_intr_handle_set() returned a positive number.
> 
> Fixes: 4870a8cdd968 ("net/tap: support Rx interrupt")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> ---
>  drivers/net/tap/rte_eth_tap.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
> index a13d8d50d..079310fea 100644
> --- a/drivers/net/tap/rte_eth_tap.c
> +++ b/drivers/net/tap/rte_eth_tap.c
> @@ -1591,8 +1591,10 @@ tap_intr_handle_set(struct rte_eth_dev *dev, int set)
>  	int err;
>  
>  	err = tap_lsc_intr_handle_set(dev, set);
> -	if (err)
> +	if (err < 0) {

+1 to "err < 0", it seems 'tap_lsc_intr_handle_set()' can return positive on
success for 'rte_intr_callback_unregister()' path.

> +		tap_rx_intr_vec_set(dev, 0);

for the case "set == 1", this function may be called and it will try to free
some resources, but this may cause redundant free calls and cause segfault, did
you able to have any chance to test this mentioned path?
What about putting a "if (!set)" before calling this function?

>  		return err;
> +	}
>  	err = tap_rx_intr_vec_set(dev, set);
>  	if (err && set)
>  		tap_lsc_intr_handle_set(dev, 0);
> 


  reply	other threads:[~2020-01-20 12:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-20  8:30 [dpdk-dev] " Yunjian Wang
2020-01-20 12:43 ` Ferruh Yigit [this message]
2020-01-21  1:36   ` [dpdk-dev] [dpdk-stable] " wangyunjian

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=78f8e06b-092b-51e2-677f-358e4f4162c8@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=keith.wiles@intel.com \
    --cc=stable@dpdk.org \
    --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).