lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Wed, 16 Aug 2017 11:31:17 -0400
From:   Doug Ledford <dledford@...hat.com>
To:     oulijun <oulijun@...wei.com>,
        Colin King <colin.king@...onical.com>,
        Wei Hu <xavier.huwei@...wei.com>,
        Sean Hefty <sean.hefty@...el.com>,
        Hal Rosenstock <hal.rosenstock@...il.com>,
        linux-rdma@...r.kernel.org
Cc:     kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH][V2] IB/hns: fix memory leak on ah on error return path

On Fri, 2017-08-11 at 09:45 +0800, oulijun wrote:
> 在 2017/8/9 1:41, Colin King 写道:
> > From: Colin Ian King <colin.king@...onical.com>
> > 
> > When dmac is NULL, ah is not being freed on the error return path.
> > Fix
> > this by kfree'ing it.
> > 
> > Detected by CoverityScan, CID#1452636 ("Resource Leak")
> > 
> > Fixes: d8966fcd4c25 ("IB/core: Use rdma_ah_attr accessor
> > functions")
> > Signed-off-by: Colin Ian King <colin.king@...onical.com>
> > ---
> >  drivers/infiniband/hw/hns/hns_roce_ah.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/infiniband/hw/hns/hns_roce_ah.c
> > b/drivers/infiniband/hw/hns/hns_roce_ah.c
> > index f78a733a63ec..d545302b8ef8 100644
> > --- a/drivers/infiniband/hw/hns/hns_roce_ah.c
> > +++ b/drivers/infiniband/hw/hns/hns_roce_ah.c
> > @@ -64,8 +64,10 @@ struct ib_ah *hns_roce_create_ah(struct ib_pd
> > *ibpd,
> >  	} else {
> >  		u8 *dmac = rdma_ah_retrieve_dmac(ah_attr);
> >  
> > -		if (!dmac)
> > +		if (!dmac) {
> > +			kfree(ah);
> >  			return ERR_PTR(-EINVAL);
> > +		}
> >  		memcpy(ah->av.mac, dmac, ETH_ALEN);
> >  	}
> >  
> 
> Thank you for reviewing and fixing

Thanks, patch applied to -rc.

-- 
Doug Ledford <dledford@...hat.com>
    GPG KeyID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ