Skip to content

Commit 4289861

Browse files
Leon Romanovskydledford
authored andcommitted
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: <[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]>
1 parent 2d87344 commit 4289861

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
@@ -1232,6 +1232,8 @@ struct ib_mr *mlx5_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
12321232
return ERR_PTR(-EINVAL);
12331233

12341234
mr = mlx5_ib_alloc_implicit_mr(to_mpd(pd), access_flags);
1235+
if (IS_ERR(mr))
1236+
return ERR_CAST(mr);
12351237
return &mr->ibmr;
12361238
}
12371239
#endif

0 commit comments

Comments
 (0)