From: Jason Gunthorpe <jgg@ziepe.ca>
To: "linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>
Cc: Michael Guralnik <michaelgur@mellanox.com>,
Yishai Hadas <yishaih@mellanox.com>
Subject: Re: [PATCH] RDMA/uverbs: Remove needs_kfree_rcu from uverbs_obj_type_class
Date: Mon, 13 Jan 2020 16:37:17 -0400 [thread overview]
Message-ID: <20200113203717.GA7112@ziepe.ca> (raw)
In-Reply-To: <20200113143306.GA28717@ziepe.ca>
On Mon, Jan 13, 2020 at 02:33:10PM +0000, Jason Gunthorpe wrote:
> After device disassociation the uapi_objects are destroyed and freed,
> however it is still possible that core code can be holding a kref on the
> uobject. When it finally goes to uverbs_uobject_free() via the kref_put()
> it can trigger a use-after-free on the uapi_object.
>
> Since needs_kfree_rcu is a micro optimization that only benefits file
> uobjects, just get rid of it. There is no harm in using kfree_rcu even if
> it isn't required, and the number of involved objects is small.
>
> Signed-off-by: Michael Guralnik <michaelgur@mellanox.com>
> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
> ---
> drivers/infiniband/core/rdma_core.c | 23 +----------------------
> include/rdma/uverbs_types.h | 1 -
> 2 files changed, 1 insertion(+), 23 deletions(-)
>
> This should go before the 'refactoring fd usage' series as more
> testing has shown the reworked code can trivially trigger this
> existing bug.
Applied to for-next
Though it seems this might not be an existing problem as none of the
existing kref users can outlive disassociation. Nevertheless it is
very surprising that the kref becomes a segfault after disassociation.
Jason
prev parent reply other threads:[~2020-01-13 20:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-13 14:33 [PATCH] RDMA/uverbs: Remove needs_kfree_rcu from uverbs_obj_type_class Jason Gunthorpe
2020-01-13 20:37 ` Jason Gunthorpe [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=20200113203717.GA7112@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=linux-rdma@vger.kernel.org \
--cc=michaelgur@mellanox.com \
--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).