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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 03, 2012 at 05:37:33PM +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@xxxxxxxxxxxxxxxxx>
> 
> 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@xxxxxxxxxxxxxxxxx>
> ---
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))
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-s390" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux