mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-03 23:58:05 +00:00
RDMA/hns: Validate the pkey index
[ Upstream commit2a67fcfa0d
] Before query pkey, make sure that the queried index is valid. Fixes:9a4435375c
("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>
This commit is contained in:
parent
492feaef41
commit
3407ffb35c
1 changed files with 3 additions and 0 deletions
|
@ -294,6 +294,9 @@ static int hns_roce_query_gid(struct ib_device *ib_dev, u8 port_num, int index,
|
|||
static int hns_roce_query_pkey(struct ib_device *ib_dev, u8 port, u16 index,
|
||||
u16 *pkey)
|
||||
{
|
||||
if (index > 0)
|
||||
return -EINVAL;
|
||||
|
||||
*pkey = PKEY_ID;
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue