Commit cf26deff authored by Yishai Hadas's avatar Yishai Hadas Committed by Jason Gunthorpe

RDMA/mlx5: Fix udata response upon SRQ creation

Fix udata response upon SRQ creation to use the UAPI structure (i.e.
mlx5_ib_create_srq_resp). It did not zero the reserved field in userspace.

Fixes: e126ba97 ("mlx5: Add driver for Mellanox Connect-IB adapters")
Link: https://lore.kernel.org/r/20200406173540.1466477-1-leon@kernel.orgSigned-off-by: default avatarYishai Hadas <yishaih@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 0184afd1
...@@ -310,12 +310,18 @@ int mlx5_ib_create_srq(struct ib_srq *ib_srq, ...@@ -310,12 +310,18 @@ int mlx5_ib_create_srq(struct ib_srq *ib_srq,
srq->msrq.event = mlx5_ib_srq_event; srq->msrq.event = mlx5_ib_srq_event;
srq->ibsrq.ext.xrc.srq_num = srq->msrq.srqn; srq->ibsrq.ext.xrc.srq_num = srq->msrq.srqn;
if (udata) if (udata) {
if (ib_copy_to_udata(udata, &srq->msrq.srqn, sizeof(__u32))) { struct mlx5_ib_create_srq_resp resp = {
.srqn = srq->msrq.srqn,
};
if (ib_copy_to_udata(udata, &resp, min(udata->outlen,
sizeof(resp)))) {
mlx5_ib_dbg(dev, "copy to user failed\n"); mlx5_ib_dbg(dev, "copy to user failed\n");
err = -EFAULT; err = -EFAULT;
goto err_core; goto err_core;
} }
}
init_attr->attr.max_wr = srq->msrq.max - 1; init_attr->attr.max_wr = srq->msrq.max - 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment