From: Sagi Grimberg <sagig@dev.mellanox.co.il>
To: Christoph Hellwig <hch@lst.de>,
Doug Ledford <dledford@redhat.com>,
Sean Hefty <sean.hefty@intel.com>,
Hal Rosenstock <hal.rosenstock@gmail.com>,
Eli Cohen <eli@mellanox.com>
Cc: linux-rdma@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 1/3] IB/uverbs: reject invalid or unknown opcodes
Date: Thu, 20 Aug 2015 11:52:35 +0300 [thread overview]
Message-ID: <55D59553.4080306@dev.mellanox.co.il> (raw)
In-Reply-To: <1440002254-795-2-git-send-email-hch@lst.de>
On 8/19/2015 7:37 PM, Christoph Hellwig wrote:
> We have many WR opcodes that are only supported in kernel space
> and/or require optional information to be copied into the WR
> structure. Reject all those not explicitly handled so that we
> can't pass invalid information to drivers.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> drivers/infiniband/core/uverbs_cmd.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
> index a15318a..f9f3921 100644
> --- a/drivers/infiniband/core/uverbs_cmd.c
> +++ b/drivers/infiniband/core/uverbs_cmd.c
> @@ -2372,6 +2372,12 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file,
> next->send_flags = user_wr->send_flags;
>
> if (is_ud) {
> + if (next->opcode != IB_WR_SEND &&
> + next->opcode != IB_WR_SEND_WITH_IMM) {
> + ret = -EINVAL;
> + goto out_put;
> + }
> +
> next->wr.ud.ah = idr_read_ah(user_wr->wr.ud.ah,
> file->ucontext);
> if (!next->wr.ud.ah) {
> @@ -2413,7 +2419,8 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file,
> next->wr.atomic.rkey = user_wr->wr.atomic.rkey;
> break;
> default:
> - break;
> + ret = -EINVAL;
> + goto out_put;
> }
> }
>
>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Haggai, can you also have a look?
next prev parent reply other threads:[~2015-08-20 8:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1440002254-795-1-git-send-email-hch@lst.de>
2015-08-19 16:37 ` [PATCH 1/3] IB/uverbs: reject invalid or unknown opcodes Christoph Hellwig
2015-08-19 17:46 ` Jason Gunthorpe
2015-08-19 17:48 ` Christoph Hellwig
2015-08-19 17:54 ` Jason Gunthorpe
2015-08-20 8:49 ` Sagi Grimberg
2015-08-20 22:30 ` Steve Wise
2015-08-19 19:50 ` Hefty, Sean
2015-08-20 9:22 ` Christoph Hellwig
2015-08-20 8:52 ` Sagi Grimberg [this message]
2015-08-22 6:38 ` Haggai Eran
2015-08-22 8:25 ` Christoph Hellwig
2015-08-24 6:52 ` Haggai Eran
2015-08-24 6:55 ` Christoph Hellwig
2015-08-24 7:59 ` Haggai Eran
2015-08-25 8:55 ` Christoph Hellwig
[not found] <1440579639-10684-1-git-send-email-hch@lst.de>
2015-08-26 9:00 ` Christoph Hellwig
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=55D59553.4080306@dev.mellanox.co.il \
--to=sagig@dev.mellanox.co.il \
--cc=dledford@redhat.com \
--cc=eli@mellanox.com \
--cc=hal.rosenstock@gmail.com \
--cc=hch@lst.de \
--cc=linux-rdma@vger.kernel.org \
--cc=sean.hefty@intel.com \
--cc=stable@vger.kernel.org \
/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).