IB/{core, mlx5}: Fix input len in vendor part of create_qp/srq
authorMajd Dibbiny <majd@mellanox.com>
Sun, 14 Feb 2016 16:35:52 +0000 (18:35 +0200)
committerDoug Ledford <dledford@redhat.com>
Thu, 3 Mar 2016 15:00:18 +0000 (10:00 -0500)
commit3d943c9d1cc5ad1825e46291ef5ce627e1b6b660
tree1e8382403949388ffede81a275dc5c81bb3a6072
parent85d9691ccc96d95629939a877fd6c1f8c4724f56
IB/{core, mlx5}: Fix input len in vendor part of create_qp/srq

Currently, the inlen field of the vendor's part of the command
doesn't match the command buffer. This happens because the inlen
accommodates ib_uverbs_cmd_hdr which is deducted from the in buffer.
This is problematic since the vendor function could be called either
from the legacy verb (where the input length mismatches the actual
length) or by the extended verb (where the length matches). The vendor
has no idea which function calls it and therefore has no way to know
how the length variable should be treated.

Fixing this by aligning the inlen to the correct length.

All vendor drivers either assumed that inlen >= sizeof(vendor_uhw_cmd)
or just failed wrongly (mlx5) and fixed in this patch.

Fixes: cfb5e088e26a ('IB/mlx5: Add CQE version 1 support to user QPs and SRQs')
Signed-off-by: Majd Dibbiny <majd@mellanox.com>
Reviewed-by: Matan Barak <matanb@mellanox.com>
Reviewed-by: Haggai Eran <haggaie@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/core/uverbs_cmd.c
drivers/infiniband/hw/mlx5/srq.c