From: frank.blaschka@de•ibm.com
To: davem@davemloft•net
Cc: netdev@vger•kernel.org, linux-s390@vger•kernel.org,
Wei Yongjun <yongjun_wei@trendmicro•com.cn>
Subject: [patch 3/5] [PATCH] qeth: fix possible memory leak in qeth_l3_add_[vipa|rxip]()
Date: Mon, 24 Sep 2012 16:24:25 +0200 [thread overview]
Message-ID: <20120924142501.240612803@de.ibm.com> (raw)
In-Reply-To: 20120924142422.001953152@de.ibm.com
[-- Attachment #1: 602-qeth-memory-leak-l3.diff --]
[-- Type: text/plain, Size: 1211 bytes --]
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>
Signed-off-by: Frank Blaschka <frank.blaschka@de•ibm.com>
---
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))
--
1.7.11.7
next prev parent reply other threads:[~2012-09-24 14:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-24 14:24 [patch 0/5] s390: network patches for net-next frank.blaschka
2012-09-24 14:24 ` [patch 1/5] [PATCH] qeth: cleanup channel path descriptor function frank.blaschka
2012-09-24 14:24 ` [patch 2/5] [PATCH] lcs: ensure proper ccw setup frank.blaschka
2012-09-24 14:24 ` frank.blaschka [this message]
2012-09-24 14:24 ` [patch 4/5] [PATCH] drivers/s390/net: removes unnecessary semicolon frank.blaschka
2012-09-24 14:24 ` [patch 5/5] [PATCH] ctcm: fix error return code frank.blaschka
2012-09-24 19:47 ` [patch 0/5] s390: network patches for net-next David Miller
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=20120924142501.240612803@de.ibm.com \
--to=frank.blaschka@de$(echo .)ibm.com \
--cc=davem@davemloft$(echo .)net \
--cc=linux-s390@vger$(echo .)kernel.org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=yongjun_wei@trendmicro$(echo .)com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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