RDMA/core: Sanitize WQ state received from the userspace
authorLeon Romanovsky <leonro@nvidia.com>
Wed, 19 May 2021 08:37:31 +0000 (11:37 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jul 2021 14:56:19 +0000 (16:56 +0200)
commit42800fcff3f917af59371bc1cea3093f72c7714d
treea600103a86399d6dbe52b4f93e442ca54fcb3e40
parentc470dd34c682a5d64067ac4955d3080656204ac6
RDMA/core: Sanitize WQ state received from the userspace

[ Upstream commit f97442887275d11c88c2899e720fe945c1f61488 ]

The mlx4 and mlx5 implemented differently the WQ input checks.  Instead of
duplicating mlx4 logic in the mlx5, let's prepare the input in the central
place.

The mlx5 implementation didn't check for validity of state input.  It is
not real bug because our FW checked that, but still worth to fix.

Fixes: f213c0527210 ("IB/uverbs: Add WQ support")
Link: https://lore.kernel.org/r/ac41ad6a81b095b1a8ad453dcf62cf8d3c5da779.1621413310.git.leonro@nvidia.com
Reported-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/core/uverbs_cmd.c
drivers/infiniband/hw/mlx4/qp.c
drivers/infiniband/hw/mlx5/qp.c