IB/hfi1: Ensure ucast_dlid access doesnt exceed bounds
authorDennis Dalessandro <dennis.dalessandro@intel.com>
Wed, 26 Sep 2018 17:55:53 +0000 (10:55 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 24 Nov 2019 07:22:52 +0000 (08:22 +0100)
commit73289863ed4adb2afdac324be6efae8459305a8d
tree013e955167e66d8361a5ac5c44d9586fd4b3e621
parent5320b434be4bd94b04b535f46087f4db140fb8e5
IB/hfi1: Ensure ucast_dlid access doesnt exceed bounds

[ Upstream commit 3144533bf667c8e53bb20656b78295960073e57b ]

The dlid assignment made by looking into the u_ucast_dlid array does not
do an explicit check for the size of the array. The code path to arrive at
def_port, the index value is long and complicated so its best to just have
an explicit check here.

Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.c