Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: jackm <jackm@dev.mellanox.co.il>
Cc: Leon Romanovsky <leon@kernel.org>,
	Doug Ledford <dledford@redhat.com>,
	linux-rdma@vger.kernel.org, ferasda@mellanox.com,
	mohammadkab@mellanox.com, moshet@mellanox.com
Subject: Re: [PATCH rdma-rc v1] IB/core: Fix potential NULL pointer dereference in pkey cache
Date: Wed, 6 May 2020 15:57:37 -0300	[thread overview]
Message-ID: <20200506185737.GJ26002@ziepe.ca> (raw)
In-Reply-To: <20200506214123.0000121c@dev.mellanox.co.il>

On Wed, May 06, 2020 at 09:41:23PM +0300, jackm wrote:
> On Wed, 6 May 2020 15:09:36 -0300
> Jason Gunthorpe <jgg@ziepe.ca> wrote:
> 
> > > > > +out:
> > > > > +	ib_cache_release_one(device);
> > > > > +	return err;  
> > > >
> > > > ib_cache_release_once can be called only once, and it is always
> > > > called by ib_device_release(), it should not be called here  
> > > 
> > > It doesn't sound right if we rely on ib_device_release() to unwind
> > > error in ib_cache_setup_one(). I don't think that we need to return
> > > from ib_cache_setup_one() without cleaning it.  
> > 
> > We do as ib_cache_release_one() cannot be called multiple times
> > 
> > The general design of all this pre-registration stuff is that the
> > release function does the clean up and the individual functions should
> > not error unwind cleanup done in the unconditional release.
> > 
> > Other schemes were too complicated
> > 
> > Jason
> 
> What about calling gid_table_release_one(device) instead of
> ib_cache_release_one(device) in the error flow ?

Why?

That is not the design, everything that is freed by release is defered
to release, even on error paths.

Jason

  reply	other threads:[~2020-05-06 18:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-06  5:32 [PATCH rdma-rc v1] IB/core: Fix potential NULL pointer dereference in pkey cache Leon Romanovsky
2020-05-06 14:43 ` Jason Gunthorpe
2020-05-06 16:56   ` Leon Romanovsky
2020-05-06 18:09     ` Jason Gunthorpe
2020-05-06 18:31       ` Leon Romanovsky
2020-05-06 18:41       ` jackm
2020-05-06 18:57         ` Jason Gunthorpe [this message]
2020-05-07  5:58           ` Leon Romanovsky

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=20200506185737.GJ26002@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=dledford@redhat.com \
    --cc=ferasda@mellanox.com \
    --cc=jackm@dev.mellanox.co.il \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mohammadkab@mellanox.com \
    --cc=moshet@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