diff options
author | Leon Romanovsky <leonro@mellanox.com> | 2018-03-13 15:29:24 +0200 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2018-03-15 10:59:58 -0400 |
commit | 4289861d88d6c7b5e4c8cc7fe2ad6cdf0cdfc366 (patch) | |
tree | 278b0108d1252ed18f23f80bb9d9e8c316bff069 /drivers/infiniband/hw/mlx5/mr.c | |
parent | 2d873449a202d02e0c4d90009fb2beb7013ac575 (diff) |
RDMA/mlx5: Protect from NULL pointer derefence
The mlx5_ib_alloc_implicit_mr() can fail to acquire pages
and the returned mr pointer won't be valid. Ensure that it
is not error prior to access.
Cc: <stable@vger.kernel.org> # 4.10
Fixes: 81713d3788d2 ("IB/mlx5: Add implicit MR support")
Reported-by: Noa Osherovich <noaos@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/hw/mlx5/mr.c')
-rw-r--r-- | drivers/infiniband/hw/mlx5/mr.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c index 45d9044a1ba9..c7a8ece05bd2 100644 --- a/drivers/infiniband/hw/mlx5/mr.c +++ b/drivers/infiniband/hw/mlx5/mr.c @@ -1232,6 +1232,8 @@ struct ib_mr *mlx5_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, return ERR_PTR(-EINVAL); mr = mlx5_ib_alloc_implicit_mr(to_mpd(pd), access_flags); + if (IS_ERR(mr)) + return ERR_CAST(mr); return &mr->ibmr; } #endif |