linux-s390.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frank Blaschka <blaschka@linux.vnet.ibm.com>
To: linux-s390@vger.kernel.org
Subject: Re: [PATCH] qeth: fix possible memory leak in qeth_l3_add_[vipa|rxip]()
Date: Tue, 04 Sep 2012 08:13:13 +0000	[thread overview]
Message-ID: <20120904081313.GA35191@tuxmaker.boeblingen.de.ibm.com> (raw)
In-Reply-To: <CAPgLHd95W1aCZ1Z6mNC8pZ1j9AmTKso4nwFYS1cFn69Xz0aUSQ@mail.gmail.com>

On Mon, Sep 03, 2012 at 05:37:33PM +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> ipaddr has been allocated in function qeth_l3_add_vipa() but
> does not free before leaving from the error handling cases. The
> same problem also exists in function qeth_l3_add_rxip().
> 
> spatch with a semantic match is used to found this problem.
> (http://coccinelle.lip6.fr/)
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
added this one to my local tree. THX!

Frank
>  drivers/s390/net/qeth_l3_main.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
> index c5f03fa..4cd310c 100644
> --- a/drivers/s390/net/qeth_l3_main.c
> +++ b/drivers/s390/net/qeth_l3_main.c
> @@ -794,6 +794,7 @@ int qeth_l3_add_vipa(struct qeth_card *card, enum qeth_prot_versions proto,
>  		rc = -EEXIST;
>  	spin_unlock_irqrestore(&card->ip_lock, flags);
>  	if (rc) {
> +		kfree(ipaddr);
>  		return rc;
>  	}
>  	if (!qeth_l3_add_ip(card, ipaddr))
> @@ -858,6 +859,7 @@ int qeth_l3_add_rxip(struct qeth_card *card, enum qeth_prot_versions proto,
>  		rc = -EEXIST;
>  	spin_unlock_irqrestore(&card->ip_lock, flags);
>  	if (rc) {
> +		kfree(ipaddr);
>  		return rc;
>  	}
>  	if (!qeth_l3_add_ip(card, ipaddr))
> 
> 

           reply	other threads:[~2012-09-04  8:13 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <CAPgLHd95W1aCZ1Z6mNC8pZ1j9AmTKso4nwFYS1cFn69Xz0aUSQ@mail.gmail.com>]

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=20120904081313.GA35191@tuxmaker.boeblingen.de.ibm.com \
    --to=blaschka@linux.vnet.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    /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).