From: Jason Gunthorpe <jgg@ziepe.ca>
To: Jann Horn <jannh@google.com>
Cc: Doug Ledford <dledford@redhat.com>,
linux-rdma@vger.kernel.org, Sean Hefty <sean.hefty@intel.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] RDMA/ucma: check fd type in ucma_migrate_id()
Date: Tue, 4 Sep 2018 15:24:25 -0600 [thread overview]
Message-ID: <20180904212425.GD18686@ziepe.ca> (raw)
In-Reply-To: <20180903165414.248309-1-jannh@google.com>
On Mon, Sep 03, 2018 at 06:54:14PM +0200, Jann Horn wrote:
> The current code grabs the private_data of whatever file descriptor
> userspace has supplied and implicitly casts it to a `struct ucma_file *`,
> potentially causing a type confusion.
>
> This is probably fine in practice because the pointer is only used for
> comparisons, it is never actually dereferenced; and even in the
> comparisons, it is unlikely that a file from another filesystem would have
> a ->private_data pointer that happens to also be valid in this context.
> But ->private_data is not always guaranteed to be a valid pointer to an
> object owned by the file's filesystem; for example, some filesystems just
> cram numbers in there.
>
> Check the type of the supplied file descriptor to be safe, analogous to how
> other places in the kernel do it.
>
> Fixes: 88314e4dda1e ("RDMA/cma: add support for rdma_migrate_id()")
> Signed-off-by: Jann Horn <jannh@google.com>
> ---
> Only compile-tested, because I don't have an environment in which I
> could test this.
>
> drivers/infiniband/core/ucma.c | 6 ++++++
> 1 file changed, 6 insertions(+)
Yep, this looks right to me also, applied to for-rc, thanks
Jason
prev parent reply other threads:[~2018-09-04 21:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-03 16:54 [PATCH] RDMA/ucma: check fd type in ucma_migrate_id() Jann Horn
2018-09-04 21:24 ` 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=20180904212425.GD18686@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=dledford@redhat.com \
--cc=jannh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sean.hefty@intel.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