From: Leon Romanovsky <leon@kernel.org>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: Doug Ledford <dledford@redhat.com>,
Avihai Horon <avihaih@nvidia.com>,
Amit Matityahu <mitm@nvidia.com>,
linux-rdma@vger.kernel.org
Subject: Re: [PATCH rdma-next v1] RDMA/ucma: Fix use-after-free bug in ucma_create_uevent
Date: Thu, 4 Feb 2021 18:08:20 +0200 [thread overview]
Message-ID: <20210204160820.GD93433@unreal> (raw)
In-Reply-To: <20210203200116.GA740542@nvidia.com>
On Wed, Feb 03, 2021 at 04:01:16PM -0400, Jason Gunthorpe wrote:
> On Mon, Jan 25, 2021 at 02:15:56PM +0200, Leon Romanovsky wrote:
> > diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
> > index e17ba841e204..7ce4d9dea826 100644
> > +++ b/drivers/infiniband/core/cma.c
> > @@ -352,7 +352,13 @@ struct ib_device *cma_get_ib_dev(struct cma_device *cma_dev)
> >
> > struct cma_multicast {
> > struct rdma_id_private *id_priv;
> > - struct ib_sa_multicast *sa_mc;
> > + union {
> > + struct ib_sa_multicast *sa_mc;
> > + struct {
> > + struct work_struct work;
> > + struct rdma_cm_event event;
> > + } iboe_join;
> > + };
> > struct list_head list;
> > void *context;
> > struct sockaddr_storage addr;
> > @@ -1839,6 +1845,12 @@ static void destroy_mc(struct rdma_id_private *id_priv,
> > cma_igmp_send(ndev, &mgid, false);
> > dev_put(ndev);
> > }
> > +
> > + if (cancel_work_sync(&mc->iboe_join.work))
> > + /* Compensate for cma_iboe_join_work_handler that
> > + * didn't run.
> > + */
> > + cma_id_put(mc->id_priv);
>
> Just get rid of the cma_id_get in cma_iboe_join_multicast() and don't
> have this if
Why do you think that it is safe to queue work without refcount?
Thanks
next prev parent reply other threads:[~2021-02-04 16:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-25 12:15 [PATCH rdma-next v1] RDMA/ucma: Fix use-after-free bug in ucma_create_uevent Leon Romanovsky
2021-02-03 20:01 ` Jason Gunthorpe
2021-02-04 16:08 ` Leon Romanovsky [this message]
2021-02-04 16:10 ` Jason Gunthorpe
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=20210204160820.GD93433@unreal \
--to=leon@kernel.org \
--cc=avihaih@nvidia.com \
--cc=dledford@redhat.com \
--cc=jgg@nvidia.com \
--cc=linux-rdma@vger.kernel.org \
--cc=mitm@nvidia.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