lkml.org 
[lkml]   [2015]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.10 25/56] IB/uverbs: reject invalid or unknown opcodes
    Date
    3.10-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Christoph Hellwig <hch@lst.de>

    commit b632ffa7cee439ba5dce3b3bc4a5cbe2b3e20133 upstream.

    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.

    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
    Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
    Signed-off-by: Doug Ledford <dledford@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    drivers/infiniband/core/uverbs_cmd.c | 10 +++++++++-
    1 file changed, 9 insertions(+), 1 deletion(-)

    --- a/drivers/infiniband/core/uverbs_cmd.c
    +++ b/drivers/infiniband/core/uverbs_cmd.c
    @@ -2106,6 +2106,12 @@ ssize_t ib_uverbs_post_send(struct ib_uv
    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) {
    @@ -2142,9 +2148,11 @@ ssize_t ib_uverbs_post_send(struct ib_uv
    user_wr->wr.atomic.compare_add;
    next->wr.atomic.swap = user_wr->wr.atomic.swap;
    next->wr.atomic.rkey = user_wr->wr.atomic.rkey;
    + case IB_WR_SEND:
    break;
    default:
    - break;
    + ret = -EINVAL;
    + goto out_put;
    }
    }




    \
     
     \ /
      Last update: 2015-09-29 16:21    [W:5.142 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site