stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] RDMA/uverbs: Fix the check for port number
       [not found] <1500040430-12844-1-git-send-email-mustafa.ismail@intel.com>
@ 2017-07-14 13:53 ` Mustafa Ismail
  2017-07-14 13:53 ` [PATCH v2 2/2] RDMA/core: Initialize port_num in qp_attr Mustafa Ismail
  1 sibling, 0 replies; 4+ messages in thread
From: Mustafa Ismail @ 2017-07-14 13:53 UTC (permalink / raw)
  To: mustafa.ismail; +Cc: # v2 . 6 . 14+

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")
Cc: <stable@vger.kernel.org> # v2.6.14+
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com>
---
 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

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

* [PATCH v2 2/2] RDMA/core: Initialize port_num in qp_attr
       [not found] <1500040430-12844-1-git-send-email-mustafa.ismail@intel.com>
  2017-07-14 13:53 ` [PATCH v2 1/2] RDMA/uverbs: Fix the check for port number Mustafa Ismail
@ 2017-07-14 13:53 ` Mustafa Ismail
  1 sibling, 0 replies; 4+ messages in thread
From: Mustafa Ismail @ 2017-07-14 13:53 UTC (permalink / raw)
  To: mustafa.ismail; +Cc: # v2 . 6 . 14+

Initialize the port_num for iWARP in rdma_init_qp_attr.

Fixes: 5ecce4c9b17b("Check port number supplied by user verbs cmds")
Cc: <stable@vger.kernel.org> # v2.6.14+
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com>
---
 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

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

* [PATCH v2 1/2] RDMA/uverbs: Fix the check for port number
       [not found] <1500040931-19400-1-git-send-email-mustafa.ismail@intel.com>
@ 2017-07-14 14:02 ` Mustafa Ismail
  0 siblings, 0 replies; 4+ messages in thread
From: Mustafa Ismail @ 2017-07-14 14:02 UTC (permalink / raw)
  To: mustafa.ismail; +Cc: shiraz.saleem, tatyana.e.nikolova, # v2 . 6 . 14+

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")
Cc: <stable@vger.kernel.org> # v2.6.14+
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com>
---
 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

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

* RE: [PATCH v2 1/2] RDMA/uverbs: Fix the check for port number
  2017-07-19 20:34 ` [v2,1/2] RDMA/uverbs: Fix the check for port number Ismail, Mustafa
@ 2017-07-17 19:10   ` Marciniszyn, Mike
  0 siblings, 0 replies; 4+ messages in thread
From: Marciniszyn, Mike @ 2017-07-17 19:10 UTC (permalink / raw)
  To: Ismail, Mustafa, linux-rdma@vger.kernel.org, dledford@redhat.com
  Cc: swise@opengridcomputing.com, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, e1000-rdma@lists.sourceforge.net,
	Saleem, Shiraz

> Subject: [PATCH v2 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")
> Cc: <stable@vger.kernel.org> # v2.6.14+
> Reviewed-by: Steve Wise <swise@opengridcomputing.com>
> Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com>

Tested-by: Mike Marciniszyn <mike.marciniszyn@intel.com>

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

end of thread, other threads:[~2017-07-17 19:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1500040430-12844-1-git-send-email-mustafa.ismail@intel.com>
2017-07-14 13:53 ` [PATCH v2 1/2] RDMA/uverbs: Fix the check for port number Mustafa Ismail
2017-07-14 13:53 ` [PATCH v2 2/2] RDMA/core: Initialize port_num in qp_attr Mustafa Ismail
     [not found] <1500040931-19400-1-git-send-email-mustafa.ismail@intel.com>
2017-07-14 14:02 ` [PATCH v2 1/2] RDMA/uverbs: Fix the check for port number Mustafa Ismail
2017-07-14 14:41 [PATCH v2 0/2] Fix modify_qp failure Mustafa Ismail
2017-07-19 20:34 ` [v2,1/2] RDMA/uverbs: Fix the check for port number Ismail, Mustafa
2017-07-17 19:10   ` [PATCH v2 1/2] " Marciniszyn, Mike

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).