2017-07-13 19:37:44

by Ismail, Mustafa

[permalink] [raw]
Subject: [PATCH 0/2] Fix modify_qp failure

Commit 5ecce4c9b17b("Check port number supplied by user verbs cmds") causes
modify_qp to fail because port_num is only valid when the mask is set.

Additionally, for iWARP, the port_num is not initialized which also causes
modify_qp to fail.

This series fixes both issues.

Mustafa Ismail (2):
RDMA/uverbs: Fix the check for port number
RDMA/core: Initialize port_num in qp_attr

drivers/infiniband/core/cma.c | 2 ++
drivers/infiniband/core/uverbs_cmd.c | 3 ++-
2 files changed, 4 insertions(+), 1 deletion(-)

--
2.7.4


2017-07-13 19:37:49

by Ismail, Mustafa

[permalink] [raw]
Subject: [PATCH 1/2] RDMA/uverbs: Fix the check for port number

The port number is only valid if IB_QP_PORT is set in the mask.
So only check port number if it is valid to prevent modify_qp from
failing due to an invalid port number.

Fixes: 5ecce4c9b17b("Check port number supplied by user verbs cmds")
Signed-off-by: Mustafa Ismail <[email protected]>
---
drivers/infiniband/core/uverbs_cmd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 8ba9bfb..19de068 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -1935,7 +1935,8 @@ static int modify_qp(struct ib_uverbs_file *file,
goto out;
}

- if (!rdma_is_port_valid(qp->device, cmd->base.port_num)) {
+ if ((cmd->base.attr_mask & IB_QP_PORT) &&
+ !rdma_is_port_valid(qp->device, cmd->base.port_num)) {
ret = -EINVAL;
goto release_qp;
}
--
2.7.4

2017-07-13 19:37:56

by Ismail, Mustafa

[permalink] [raw]
Subject: [PATCH 2/2] RDMA/core: Initialize port_num in qp_attr

Initialize the port_num for iWARP in rdma_init_qp_attr.

Signed-off-by: Mustafa Ismail <[email protected]>
---
drivers/infiniband/core/cma.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 31bb82d..d65a093 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -1044,6 +1044,8 @@ int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr,
} else
ret = iw_cm_init_qp_attr(id_priv->cm_id.iw, qp_attr,
qp_attr_mask);
+ qp_attr->port_num = id_priv->id.port_num;
+ *qp_attr_mask |= IB_QP_PORT;
} else
ret = -ENOSYS;

--
2.7.4

2017-07-13 20:24:37

by Steve Wise

[permalink] [raw]
Subject: RE: [PATCH 1/2] RDMA/uverbs: Fix the check for port number

> The port number is only valid if IB_QP_PORT is set in the mask.
> So only check port number if it is valid to prevent modify_qp from
> failing due to an invalid port number.
>
> Fixes: 5ecce4c9b17b("Check port number supplied by user verbs cmds")
> Signed-off-by: Mustafa Ismail <[email protected]>

Looks good.

Reviewed-by: Steve Wise <[email protected]>

2017-07-13 20:25:01

by Steve Wise

[permalink] [raw]
Subject: RE: [PATCH 2/2] RDMA/core: Initialize port_num in qp_attr

> Initialize the port_num for iWARP in rdma_init_qp_attr.
>
> Signed-off-by: Mustafa Ismail <[email protected]>

Looks fine.

Reviewed-by: Steve Wise <[email protected]>

2017-07-14 06:47:58

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 2/2] RDMA/core: Initialize port_num in qp_attr

On Thu, Jul 13, 2017 at 02:37:38PM -0500, Mustafa Ismail wrote:
> Initialize the port_num for iWARP in rdma_init_qp_attr.
>
> Signed-off-by: Mustafa Ismail <[email protected]>
> ---
> drivers/infiniband/core/cma.c | 2 ++
> 1 file changed, 2 insertions(+)

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

2017-07-14 06:48:18

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 1/2] RDMA/uverbs: Fix the check for port number

On Thu, Jul 13, 2017 at 02:37:37PM -0500, Mustafa Ismail wrote:
> The port number is only valid if IB_QP_PORT is set in the mask.
> So only check port number if it is valid to prevent modify_qp from
> failing due to an invalid port number.
>
> Fixes: 5ecce4c9b17b("Check port number supplied by user verbs cmds")
> Signed-off-by: Mustafa Ismail <[email protected]>
> ---
> drivers/infiniband/core/uverbs_cmd.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>