RDMA/hns: Validate the pkey index
authorKamal Heib <kamalheib1@gmail.com>
Wed, 17 Nov 2021 14:59:54 +0000 (16:59 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 08:00:52 +0000 (09:00 +0100)
commit3407ffb35c696b57d6e5f4a34cca52893a2f3798
treee214d12712aca40651f5a9eb47f6e7a39bec11bd
parent492feaef41d4ae1f6c72f239c39bb7aba70a8493
RDMA/hns: Validate the pkey index

[ Upstream commit 2a67fcfa0db6b4075515bd23497750849b88850f ]

Before query pkey, make sure that the queried index is valid.

Fixes: 9a4435375cd1 ("IB/hns: Add driver files for hns RoCE driver")
Link: https://lore.kernel.org/r/20211117145954.123893-1-kamalheib1@gmail.com
Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/hw/hns/hns_roce_main.c