mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: dinghao.liu@zju.edu.cn
To: "Håkon Bugge" <haakon.bugge@oracle.com>
Cc: kjlu@umn.edu, "Doug Ledford" <dledford@redhat.com>,
	"Jason Gunthorpe" <jgg@ziepe.ca>,
	"Yishai Hadas" <yishaih@mellanox.com>,
	"Leon Romanovsky" <leon@kernel.org>,
	"Michel Lespinasse" <walken@google.com>,
	"Ariel Elior" <ariel.elior@marvell.com>,
	"Michal Kalderon" <michal.kalderon@marvell.com>,
	"OFED mailing list" <linux-rdma@vger.kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: Re: [PATCH] IB/uverbs: Fix memleak in ib_uverbs_add_one
Date: Sat, 22 Aug 2020 13:58:59 +0800 (GMT+08:00)	[thread overview]
Message-ID: <152fbf70.7b.17414bfaa7c.Coremail.dinghao.liu@zju.edu.cn> (raw)
In-Reply-To: <E59593D2-E7F5-4D41-B6DC-B8B8C55241CE@oracle.com>

> 
> > On 21 Aug 2020, at 10:10, Dinghao Liu <dinghao.liu@zju.edu.cn> wrote:
> > 
> > When ida_alloc_max() fails, uverbs_dev should be freed
> > just like when init_srcu_struct() fails. It's the same
> > for the error paths after this call.
> > 
> > Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> > ---
> > drivers/infiniband/core/uverbs_main.c | 1 +
> > 1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
> > index 37794d88b1f3..c6b4e3e2aff6 100644
> > --- a/drivers/infiniband/core/uverbs_main.c
> > +++ b/drivers/infiniband/core/uverbs_main.c
> > @@ -1170,6 +1170,7 @@ static int ib_uverbs_add_one(struct ib_device *device)
> > 		ib_uverbs_comp_dev(uverbs_dev);
> > 	wait_for_completion(&uverbs_dev->comp);
> > 	put_device(&uverbs_dev->dev);
> > +	kfree(uverbs_dev);
> 
> Isn't this taken care of by the *release* function pointer, which happens to be ib_uverbs_release_dev() ?
> 

You are right, thank you for pointing out that!

Regards,
Dinghao

      parent reply	other threads:[~2020-08-22  5:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-21  8:10 Dinghao Liu
2020-08-21  9:47 ` Håkon Bugge
2020-08-21 13:39   ` Jason Gunthorpe
2020-08-22  5:58   ` dinghao.liu [this message]

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=152fbf70.7b.17414bfaa7c.Coremail.dinghao.liu@zju.edu.cn \
    --to=dinghao.liu@zju.edu.cn \
    --cc=ariel.elior@marvell.com \
    --cc=dledford@redhat.com \
    --cc=haakon.bugge@oracle.com \
    --cc=jgg@ziepe.ca \
    --cc=kjlu@umn.edu \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=michal.kalderon@marvell.com \
    --cc=walken@google.com \
    --cc=yishaih@mellanox.com \
    /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

all inboxes | Powered by JetHome®