Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f68bd07c authored by Wei Yongjun's avatar Wei Yongjun Committed by David S. Miller
Browse files

qeth: fix possible memory leak in qeth_l3_add_[vipa|rxip]()

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: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarFrank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3c787475
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -794,6 +794,7 @@ int qeth_l3_add_vipa(struct qeth_card *card, enum qeth_prot_versions proto,
		rc = -EEXIST;
		rc = -EEXIST;
	spin_unlock_irqrestore(&card->ip_lock, flags);
	spin_unlock_irqrestore(&card->ip_lock, flags);
	if (rc) {
	if (rc) {
		kfree(ipaddr);
		return rc;
		return rc;
	}
	}
	if (!qeth_l3_add_ip(card, ipaddr))
	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;
		rc = -EEXIST;
	spin_unlock_irqrestore(&card->ip_lock, flags);
	spin_unlock_irqrestore(&card->ip_lock, flags);
	if (rc) {
	if (rc) {
		kfree(ipaddr);
		return rc;
		return rc;
	}
	}
	if (!qeth_l3_add_ip(card, ipaddr))
	if (!qeth_l3_add_ip(card, ipaddr))