All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-rc] RDMA/hns: Validate the pkey index
@ 2021-11-17 11:10 Kamal Heib
  2021-11-17 11:45 ` Haakon Bugge
  0 siblings, 1 reply; 3+ messages in thread
From: Kamal Heib @ 2021-11-17 11:10 UTC (permalink / raw)
  To: linux-rdma
  Cc: Wenpeng Liang, Weihang Li, Doug Ledford, Jason Gunthorpe, Kamal Heib

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 <kamalheib1@gmail.com>
---
 drivers/infiniband/hw/hns/hns_roce_main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
index 4194b626f3c6..8233bec053ee 100644
--- 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;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH for-rc] RDMA/hns: Validate the pkey index
  2021-11-17 11:10 [PATCH for-rc] RDMA/hns: Validate the pkey index Kamal Heib
@ 2021-11-17 11:45 ` Haakon Bugge
  2021-11-17 14:50   ` Kamal Heib
  0 siblings, 1 reply; 3+ messages in thread
From: Haakon Bugge @ 2021-11-17 11:45 UTC (permalink / raw)
  To: Kamal Heib
  Cc: OFED mailing list, Wenpeng Liang, Weihang Li, Doug Ledford,
	Jason Gunthorpe



> On 17 Nov 2021, at 12:10, Kamal Heib <kamalheib1@gmail.com> wrote:
> 
> Before query pkey, make sure that the quered index is valid.

queried index ?

Thxs, Håkon

> 
> Fixes: 9a4435375cd1 ("IB/hns: Add driver files for hns RoCE driver")
> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> ---
> drivers/infiniband/hw/hns/hns_roce_main.c | 3 +++
> 1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
> index 4194b626f3c6..8233bec053ee 100644
> --- 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;
> -- 
> 2.31.1
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH for-rc] RDMA/hns: Validate the pkey index
  2021-11-17 11:45 ` Haakon Bugge
@ 2021-11-17 14:50   ` Kamal Heib
  0 siblings, 0 replies; 3+ messages in thread
From: Kamal Heib @ 2021-11-17 14:50 UTC (permalink / raw)
  To: Haakon Bugge
  Cc: OFED mailing list, Wenpeng Liang, Weihang Li, Doug Ledford,
	Jason Gunthorpe

On Wed, Nov 17, 2021 at 11:45:49AM +0000, Haakon Bugge wrote:
> 
> 
> > On 17 Nov 2021, at 12:10, Kamal Heib <kamalheib1@gmail.com> wrote:
> > 
> > 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

> > 
> > Fixes: 9a4435375cd1 ("IB/hns: Add driver files for hns RoCE driver")
> > Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> > ---
> > drivers/infiniband/hw/hns/hns_roce_main.c | 3 +++
> > 1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
> > index 4194b626f3c6..8233bec053ee 100644
> > --- 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;
> > -- 
> > 2.31.1
> > 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-17 14:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-17 11:10 [PATCH for-rc] RDMA/hns: Validate the pkey index Kamal Heib
2021-11-17 11:45 ` Haakon Bugge
2021-11-17 14:50   ` Kamal Heib

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.