Skip to content

Commit

Permalink
mlx5: Fix check for SQ overflow in bind_mw
Browse files Browse the repository at this point in the history
[ Upstream commit efad770 ]

The `seg` parameter is a pointer to pointer, we need to derefernce it to
check if we reached the end of SQ. Otherwise WQE data segment can be
written past SQ.

Fixes: f14d598 ("Implement memory window bind verb for type 1")
Signed-off-by: Alexey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Sergey Gorenko <sergeygo@nvidia.com>
Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Signed-off-by: Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com>
  • Loading branch information
AlekseyMarchuk authored and nmorey committed Jun 13, 2022
1 parent f4c22a5 commit 30529e0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion providers/mlx5/qp.c
Expand Up @@ -633,7 +633,7 @@ static inline int set_bind_wr(struct mlx5_qp *qp, enum ibv_mw_type type,
if (!bind_info->length)
return 0;

if (unlikely((seg == qend)))
if (unlikely((*seg == qend)))
*seg = mlx5_get_send_wqe(qp, 0);

set_umr_data_seg(qp, type, rkey, bind_info, qpn, seg, size);
Expand Down

0 comments on commit 30529e0

Please sign in to comment.