DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
To: Congwen Zhang <zhang.congwen@zte.com.cn>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	Kumar Sanghvi <kumaras@chelsio.com>,
	Nirranjan Kirubaharan <nirranjan@chelsio.com>,
	Indranil Choudhury <indranil@chelsio.com>
Subject: Re: [dpdk-dev] [PATCH] net/cxgbe: fix memory leak
Date: Wed, 6 Sep 2017 14:55:40 +0530	[thread overview]
Message-ID: <20170906092539.GA5654@chelsio.com> (raw)
In-Reply-To: <201709050902.v8592Tm3013413@mse01.zte.com.cn>

On Tuesday, September 09/05/17, 2017 at 14:16:57 +0530, Congwen Zhang wrote:
> In function t4_wr_mbox_meat_timeout(), Dynamic memory stored
> in 'temp' not free when the functon return, It possible memory
> leak.
> 
> Signed-off-by: Congwen Zhang <zhang.congwen@zte.com.cn>
> ---
>  drivers/net/cxgbe/base/t4_hw.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
> index a8ccea0..013d996 100644
> --- a/drivers/net/cxgbe/base/t4_hw.c
> +++ b/drivers/net/cxgbe/base/t4_hw.c
> @@ -403,6 +403,7 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox,
>  			t4_os_atomic_list_del(&entry, &adap->mbox_list,
>  					      &adap->mbox_lock);
>  			t4_report_fw_error(adap);
> +			free(temp);
>  			return (pcie_fw & F_PCIE_FW_ERR) ? -ENXIO : -EBUSY;
>  		}
>  
> @@ -446,6 +447,7 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox,
>  							 &adap->mbox_list,
>  							 &adap->mbox_lock));
>  		t4_report_fw_error(adap);
> +		free(temp);
>  		return (v == X_MBOWNER_FW ? -EBUSY : -ETIMEDOUT);
>  	}
>  
> @@ -546,6 +548,7 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox,
>  			T4_OS_MBOX_LOCKING(
>  				t4_os_atomic_list_del(&entry, &adap->mbox_list,
>  						      &adap->mbox_lock));
> +			free(temp);
>  			return -G_FW_CMD_RETVAL((int)res);
>  		}
>  	}
> -- 
> 1.8.3.1
> 

Thanks for the fix!

Acked-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>

  reply	other threads:[~2017-09-06  9:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-05  8:46 Congwen Zhang
2017-09-06  9:25 ` Rahul Lakkireddy [this message]
2017-09-06 14:44   ` 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=20170906092539.GA5654@chelsio.com \
    --to=rahul.lakkireddy@chelsio.com \
    --cc=dev@dpdk.org \
    --cc=indranil@chelsio.com \
    --cc=kumaras@chelsio.com \
    --cc=nirranjan@chelsio.com \
    --cc=zhang.congwen@zte.com.cn \
    /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).