Skip to content

Commit 6512f11

Browse files
Leon Romanovskyjgunthorpe
authored andcommitted
RDMA/mlx5: Return an error if copy_to_user fails
In theoretical event, the ib_copy_to_udata() can fail, so return -EFAULT error to the user, so he will destroy the QP. Fixes: 50aec2c ("RDMA/mlx5: Return ECE data after modify QP") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 193ba03 commit 6512f11

File tree

1 file changed

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

1 file changed

+2
-6
lines changed

drivers/infiniband/hw/mlx5/qp.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4305,12 +4305,8 @@ int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
43054305
/* resp.response_length is set in ECE supported flows only */
43064306
if (!err && resp.response_length &&
43074307
udata->outlen >= resp.response_length)
4308-
/*
4309-
* We don't check return value of the function below
4310-
* on purpose, because it is unclear how to unwind the
4311-
* error flow after QP was modified to the new state.
4312-
*/
4313-
ib_copy_to_udata(udata, &resp, resp.response_length);
4308+
/* Return -EFAULT to the user and expect him to destroy QP. */
4309+
err = ib_copy_to_udata(udata, &resp, resp.response_length);
43144310

43154311
out:
43164312
mutex_unlock(&qp->mutex);

0 commit comments

Comments
 (0)