Re: [PATCH rdma-rc] RDMA: Verify port when creating flow rule

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

 



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.

> 
> 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.

> 
> Jason



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux