Skip to content

Commit 28ce82e

Browse files
Leon Romanovskygregkh
authored andcommitted
RDMA/mlx5: Protect from NULL pointer derefence
commit 4289861 upstream. 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: <[email protected]> # 4.10 Fixes: 81713d3 ("IB/mlx5: Add implicit MR support") Reported-by: Noa Osherovich <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Doug Ledford <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b140d94 commit 28ce82e

File tree

1 file changed

+2
-0
lines changed
  • drivers/infiniband/hw/mlx5

1 file changed

+2
-0
lines changed

drivers/infiniband/hw/mlx5/mr.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,8 @@ struct ib_mr *mlx5_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
12201220
return ERR_PTR(-EINVAL);
12211221

12221222
mr = mlx5_ib_alloc_implicit_mr(to_mpd(pd), access_flags);
1223+
if (IS_ERR(mr))
1224+
return ERR_CAST(mr);
12231225
return &mr->ibmr;
12241226
}
12251227
#endif

0 commit comments

Comments
 (0)