OSDN Git Service

IB/mlx4: Test port number before querying type.
authorTarick Bedeir <tarick@google.com>
Mon, 2 Jul 2018 21:02:34 +0000 (14:02 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Oct 2018 23:59:07 +0000 (16:59 -0700)
commit4fd56423854c4a811a671762fbd3f5505ec1ff45
tree107427c90b7a8760d9f7416b23b7e62882b12b88
parent76e2bf1d322a899d1d5a5e855dc5072922ec860e
IB/mlx4: Test port number before querying type.

[ Upstream commit f1228867adaf8890826f2b59e4caddb1c5cc2df7 ]

rdma_ah_find_type() can reach into ib_device->port_immutable with a
potentially out-of-bounds port number, so check that the port number is
valid first.

Fixes: 44c58487d51a ("IB/core: Define 'ib' and 'roce' rdma_ah_attr types")
Signed-off-by: Tarick Bedeir <tarick@google.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/hw/mlx4/qp.c