projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
679f2b7
)
RDMA/hns: Validate the pkey index
author
Kamal Heib
<kamalheib1@gmail.com>
Wed, 17 Nov 2021 14:59:54 +0000
(16:59 +0200)
committer
Jason Gunthorpe
<jgg@nvidia.com>
Wed, 17 Nov 2021 20:52:18 +0000
(16:52 -0400)
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>
drivers/infiniband/hw/hns/hns_roce_main.c
patch
|
blob
|
history
diff --git
a/drivers/infiniband/hw/hns/hns_roce_main.c
b/drivers/infiniband/hw/hns/hns_roce_main.c
index 4194b626f3c6524254e822f392b5c7511668af6b..8233bec053ee3c26055868a25b09315278a6413b 100644
(file)
--- a/
drivers/infiniband/hw/hns/hns_roce_main.c
+++ b/
drivers/infiniband/hw/hns/hns_roce_main.c
@@
-270,6
+270,9
@@
static enum rdma_link_layer hns_roce_get_link_layer(struct ib_device *device,
static int hns_roce_query_pkey(struct ib_device *ib_dev, u32 port, u16 index,
u16 *pkey)
{
+ if (index > 0)
+ return -EINVAL;
+
*pkey = PKEY_ID;
return 0;