From: Leon Romanovsky <leon@kernel.org>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Doug Ledford <dledford@redhat.com>,
linux-rdma@vger.kernel.org, Yishai Hadas <yishaih@mellanox.com>
Subject: Re: [PATCH rdma-rc] RDMA/core: Check that type_attrs is not NULL prior access
Date: Wed, 17 Jun 2020 07:39:43 +0300 [thread overview]
Message-ID: <20200617043943.GE2383158@unreal> (raw)
In-Reply-To: <20200616192054.GE6578@ziepe.ca>
On Tue, Jun 16, 2020 at 04:20:54PM -0300, Jason Gunthorpe wrote:
> On Tue, Jun 16, 2020 at 01:58:13PM +0300, Leon Romanovsky wrote:
> > diff --git a/drivers/infiniband/core/rdma_core.c b/drivers/infiniband/core/rdma_core.c
> > index 38de4942c682..16b86635d752 100644
> > +++ b/drivers/infiniband/core/rdma_core.c
> > @@ -470,40 +470,41 @@ static struct ib_uobject *
> > alloc_begin_fd_uobject(const struct uverbs_api_object *obj,
> > struct uverbs_attr_bundle *attrs)
> > {
> > - const struct uverbs_obj_fd_type *fd_type =
> > - container_of(obj->type_attrs, struct uverbs_obj_fd_type, type);
> > + const struct uverbs_obj_fd_type *fd_type;
> > int new_fd;
> > struct ib_uobject *uobj;
> > struct file *filp;
> >
> > + uobj = alloc_uobj(attrs, obj);
> > + if (IS_ERR(uobj))
> > + return uobj;
> > +
> > + fd_type =
> > + container_of(obj->type_attrs, struct uverbs_obj_fd_type, type);
> > if (WARN_ON(fd_type->fops->release != &uverbs_uobject_fd_release &&
> > - fd_type->fops->release != &uverbs_async_event_release))
> > + fd_type->fops->release != &uverbs_async_event_release)) {
> > + uverbs_uobject_put(uobj);
> > return ERR_PTR(-EINVAL);
> > + }
>
> I feel like this is a bit cleaner with a goto unwind ?
I don't have strong opinion about it, will resend.
Thanks
>
> Jason
prev parent reply other threads:[~2020-06-17 4:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-16 10:58 [PATCH rdma-rc] RDMA/core: Check that type_attrs is not NULL prior access Leon Romanovsky
2020-06-16 19:20 ` Jason Gunthorpe
2020-06-17 4:39 ` 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=20200617043943.GE2383158@unreal \
--to=leon@kernel.org \
--cc=dledford@redhat.com \
--cc=jgg@ziepe.ca \
--cc=linux-rdma@vger.kernel.org \
--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