public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: Doug Ledford <dledford@redhat.com>,
	Maor Gottlieb <maorg@nvidia.com>,
	linux-rdma@vger.kernel.org, Mark Bloch <markb@mellanox.com>
Subject: Re: [PATCH rdma-rc] RDMA: Verify port when creating flow rule
Date: Wed, 9 Jun 2021 16:46:48 +0300	[thread overview]
Message-ID: <YMDGSOkAXsqJCepn@unreal> (raw)
In-Reply-To: <20210609114720.GW1002214@nvidia.com>

On Wed, Jun 09, 2021 at 08:47:20AM -0300, Jason Gunthorpe wrote:
> On Wed, Jun 09, 2021 at 01:55:22PM +0300, Leon Romanovsky wrote:
> > On Tue, Jun 08, 2021 at 05:09:35PM -0300, Jason Gunthorpe wrote:
> > > On Tue, Jun 08, 2021 at 08:12:24AM +0300, Leon Romanovsky wrote:
> > > > @@ -3198,6 +3199,13 @@ static int ib_uverbs_ex_create_flow(struct uverbs_attr_bundle *attrs)
> > > >  	if (err)
> > > >  		return err;
> > > >  
> > > > +	ucontext = ib_uverbs_get_ucontext(attrs);
> > > > +	if (IS_ERR(ucontext))
> > > > +		return PTR_ERR(ucontext);
> > > 
> > > ib_uverbs_get_ucontext() should only be used by methods that don't
> > > have a uboject, this one does so it should be using uobj->context
> > > instead
> > 
> > Why "should"?
> > At the end, we will get same ucontext.
> 
> The locking methodologies are different, they are not guarenteed to be
> exactly the same, but once the uobj is obtained then the related
> ucontext is fixed.
> 
> > > It looks like this can be moved down to after the uobject is allocated
> > 
> > The idea is to fail early, before first kmalloc and uobj_alloc, so we won't need
> > to do any error unwinding.
> 
> The error handling is needed anyhow..

Thanks, I'll change.

> 
> Jason

      reply	other threads:[~2021-06-09 13:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-08  5:12 [PATCH rdma-rc] RDMA: Verify port when creating flow rule Leon Romanovsky
2021-06-08 20:09 ` Jason Gunthorpe
2021-06-09 10:55   ` Leon Romanovsky
2021-06-09 11:47     ` Jason Gunthorpe
2021-06-09 13:46       ` Leon Romanovsky [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=YMDGSOkAXsqJCepn@unreal \
    --to=leon@kernel.org \
    --cc=dledford@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=maorg@nvidia.com \
    --cc=markb@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