RDMA/hns: Validate the pkey index
Subsystems (2)
PATCH 1/1 RDMA/hns: Validate the pkey index
Before query pkey, make sure that the quered index is valid.
Fixes 9a4435375cd1 ("IB/hns: Add driver files for hns RoCE driver")
Signed-off-by Kamal Heib <[email protected]>
--- drivers/infiniband/hw/hns/hns_roce_main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/infiniband/hw/hns/hns_roce_main.c +3 -0
@@ -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 ;
Signature · 1 line
2.31.1
Quoted 5 lines · Kamal Heib
Before query pkey, make sure that the quered index is valid.
queried index ?
Thxs, Håkon
Quoted 24 lines
Fixes 9a4435375cd1 ("IB/hns: Add driver files for hns RoCE driver")Signed-off-by Kamal Heib <[email protected]>---
drivers/infiniband/hw/hns/hns_roce_main.c| 3 +++1 file changed, 3 insertions(+)drivers/infiniband/hw/hns/hns_roce_main.c +3
-0@@ -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 ;Signature · 1 line
2.31.1
Quoted 10 lines · Haakon Bugge
Quoted 5 lines · Kamal Heib
Before query pkey, make sure that the quered index is valid.
queried index ?
Thxs, Håkon
My bad, I'll fix it in v2.
Thanks,
Kamal
Quoted 25 lines
Quoted 24 lines
Fixes 9a4435375cd1 ("IB/hns: Add driver files for hns RoCE driver")Signed-off-by Kamal Heib <[email protected]>---
drivers/infiniband/hw/hns/hns_roce_main.c| 3 +++1 file changed, 3 insertions(+)drivers/infiniband/hw/hns/hns_roce_main.c +3
-0@@ -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 ;Signature · 1 line
2.31.1