IB/mlx5: Avoid passing an invalid QP type to firmware
authorNoa Osherovich <noaos@mellanox.com>
Sun, 25 Feb 2018 11:39:51 +0000 (13:39 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 10 Nov 2018 15:42:52 +0000 (07:42 -0800)
commitd287f1dab98c20bb9fd3c044b7f913ed17b4ad22
tree94f70bc1345e1d132cda7a14572357377f3b336b
parenta96406d4394498dab805beca195d41e0e34f5d87
IB/mlx5: Avoid passing an invalid QP type to firmware

[ Upstream commit e7b169f34403becd3c9fd3b6e46614ab788f2187 ]

During QP creation, the mlx5 driver translates the QP type to an
internal value which is passed on to FW. There was no check to make
sure that the translated value is valid, and -EINVAL was coerced into
the mailbox command.

Current firmware refuses this as an invalid QP type, but future/past
firmware may do something else.

Fixes: 09a7d9eca1a6c ('{net,IB}/mlx5: QP/XRCD commands via mlx5 ifc')
Reviewed-by: Ilya Lesokhin <ilyal@mellanox.com>
Signed-off-by: Noa Osherovich <noaos@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/hw/mlx5/qp.c