From: Jason Gunthorpe <jgg@mellanox.com>
To: Yishai Hadas <yishaih@dev.mellanox.co.il>
Cc: Leon Romanovsky <leon@kernel.org>,
Doug Ledford <dledford@redhat.com>,
Yishai Hadas <yishaih@mellanox.com>,
RDMA mailing list <linux-rdma@vger.kernel.org>,
Leon Romanovsky <leonro@mellanox.com>
Subject: Re: [PATCH rdma-rc] IB/mlx5: Fix use-after-free error while accessing ev_file pointer
Date: Thu, 8 Aug 2019 15:34:16 +0000 [thread overview]
Message-ID: <20190808153411.GE1975@mellanox.com> (raw)
In-Reply-To: <869b1416-a87b-f361-7722-bf9d231bc262@dev.mellanox.co.il>
On Thu, Aug 08, 2019 at 06:32:00PM +0300, Yishai Hadas wrote:
> > > diff --git a/drivers/infiniband/hw/mlx5/devx.c b/drivers/infiniband/hw/mlx5/devx.c
> > > index 2d1b3d9609d9..af5bbb35c058 100644
> > > +++ b/drivers/infiniband/hw/mlx5/devx.c
> > > @@ -2644,12 +2644,13 @@ static int devx_async_event_close(struct inode *inode, struct file *filp)
> > > struct devx_async_event_file *ev_file = filp->private_data;
> >
> > This line is wrong, it should be
> >
> > struct devx_async_event_file *ev_file = container_of(struct
> > devx_async_event_file, filp->private_data, uobj);
>
> You suggested the below 2 lines instead of the above one line, correct ? as
> struct devx_async_event_file wraps uobj as its first field this is logically
> equal, agree ?
Yes, it is wrong only in the use of the type system, the private_data
void * should only ever be cast to a ib_uobject.
> struct ib_uobject *uobj = filp->private_data;
This could be done with a cast
> > It is also a bit redundant to store the mlx5_ib_dev in the
> > devx_async_event_file as uobj->ucontext->dev is the same pointer.
> >
> Post hot unplug uobj->ucontext might not be accessible, isn't it ?
> Current code should be fine for that.
That is the other kind of weird thing, all this destruction could be
done on unplug..
> Are we fine to take this patch ?
Yes
Jason
next prev parent reply other threads:[~2019-08-08 15:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-08 8:15 [PATCH rdma-rc] IB/mlx5: Fix use-after-free error while accessing ev_file pointer Leon Romanovsky
2019-08-08 12:26 ` Jason Gunthorpe
2019-08-08 15:32 ` Yishai Hadas
2019-08-08 15:34 ` Jason Gunthorpe [this message]
2019-08-12 14:59 ` Doug Ledford
2019-08-13 10:10 ` Leon Romanovsky
2019-08-13 13:35 ` Doug Ledford
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=20190808153411.GE1975@mellanox.com \
--to=jgg@mellanox.com \
--cc=dledford@redhat.com \
--cc=leon@kernel.org \
--cc=leonro@mellanox.com \
--cc=linux-rdma@vger.kernel.org \
--cc=yishaih@dev.mellanox.co.il \
--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;
as well as URLs for NNTP newsgroup(s).