lkml.org 
[lkml]   [2018]   [Oct]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.18 032/228] IB/core: type promotion bug in rdma_rw_init_one_mr()
    Date
    4.18-stable review patch.  If anyone has any objections, please let me know.

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

    From: Dan Carpenter <dan.carpenter@oracle.com>

    [ Upstream commit c2d7c8ff89b22ddefb1ac2986c0d48444a667689 ]

    "nents" is an unsigned int, so if ib_map_mr_sg() returns a negative
    error code then it's type promoted to a high unsigned int which is
    treated as success.

    Fixes: a060b5629ab0 ("IB/core: generic RDMA READ/WRITE API")
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    drivers/infiniband/core/rw.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    --- a/drivers/infiniband/core/rw.c
    +++ b/drivers/infiniband/core/rw.c
    @@ -87,7 +87,7 @@ static int rdma_rw_init_one_mr(struct ib
    }

    ret = ib_map_mr_sg(reg->mr, sg, nents, &offset, PAGE_SIZE);
    - if (ret < nents) {
    + if (ret < 0 || ret < nents) {
    ib_mr_pool_put(qp, &qp->rdma_mrs, reg->mr);
    return -EINVAL;
    }

    \
     
     \ /
      Last update: 2018-10-02 16:15    [W:4.175 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site