lkml.org 
[lkml]   [2020]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 4.19 110/671] RDMA/qedr: Fix out of bounds index check in query pkey
    Date
    From: Gal Pressman <galpress@amazon.com>

    [ Upstream commit dbe30dae487e1a232158c24b432d45281c2805b7 ]

    The pkey table size is QEDR_ROCE_PKEY_TABLE_LEN, index should be tested
    for >= QEDR_ROCE_PKEY_TABLE_LEN instead of > QEDR_ROCE_PKEY_TABLE_LEN.

    Fixes: a7efd7773e31 ("qedr: Add support for PD,PKEY and CQ verbs")
    Signed-off-by: Gal Pressman <galpress@amazon.com>
    Acked-by: Michal Kalderon <michal.kalderon@marvell.com>
    Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/infiniband/hw/qedr/verbs.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
    index 9167a1c40bcf..8fd8b97348bf 100644
    --- a/drivers/infiniband/hw/qedr/verbs.c
    +++ b/drivers/infiniband/hw/qedr/verbs.c
    @@ -67,7 +67,7 @@ static inline int qedr_ib_copy_to_udata(struct ib_udata *udata, void *src,

    int qedr_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 *pkey)
    {
    - if (index > QEDR_ROCE_PKEY_TABLE_LEN)
    + if (index >= QEDR_ROCE_PKEY_TABLE_LEN)
    return -EINVAL;

    *pkey = QEDR_ROCE_PKEY_DEFAULT;
    --
    2.20.1
    \
     
     \ /
      Last update: 2020-01-16 17:58    [W:4.057 / U:0.464 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site