aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtemy Kovalyov <artemyko@mellanox.com>2019-05-01 01:39:48 -0400
committerJason Gunthorpe <jgg@mellanox.com>2019-05-03 09:17:45 -0400
commit1a418f7764a00bc6ad8fd1b765b941c3a8389467 (patch)
treeb20bfdb6ed297bc29fdd338937f56612e1196072
parent8f4426aa19fcdb9326ac44154a117b1a3a5ae126 (diff)
IB/core: Set qp->real_qp before it may be accessed
real_qp should be initialized before ib_destroy_qp() is called. ib_destroy_qp() may be called in the error flow if ib_create_qp_security() failed. Signed-off-by: Artemy Kovalyov <artemyko@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
-rw-r--r--drivers/infiniband/core/core_priv.h1
-rw-r--r--drivers/infiniband/core/uverbs_cmd.c1
-rw-r--r--drivers/infiniband/core/verbs.c1
3 files changed, 1 insertions, 2 deletions
diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h
index d4dd360769cb..2764647056d8 100644
--- a/drivers/infiniband/core/core_priv.h
+++ b/drivers/infiniband/core/core_priv.h
@@ -304,6 +304,7 @@ static inline struct ib_qp *_ib_create_qp(struct ib_device *dev,
304 qp->device = dev; 304 qp->device = dev;
305 qp->pd = pd; 305 qp->pd = pd;
306 qp->uobject = uobj; 306 qp->uobject = uobj;
307 qp->real_qp = qp;
307 /* 308 /*
308 * We don't track XRC QPs for now, because they don't have PD 309 * We don't track XRC QPs for now, because they don't have PD
309 * and more importantly they are created internaly by driver, 310 * and more importantly they are created internaly by driver,
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 76ac113d1da5..5a3a1780ceea 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -1418,7 +1418,6 @@ static int create_qp(struct uverbs_attr_bundle *attrs,
1418 if (ret) 1418 if (ret)
1419 goto err_cb; 1419 goto err_cb;
1420 1420
1421 qp->real_qp = qp;
1422 qp->pd = pd; 1421 qp->pd = pd;
1423 qp->send_cq = attr.send_cq; 1422 qp->send_cq = attr.send_cq;
1424 qp->recv_cq = attr.recv_cq; 1423 qp->recv_cq = attr.recv_cq;
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index 7313edc9f091..d607c319ad50 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -1172,7 +1172,6 @@ struct ib_qp *ib_create_qp_user(struct ib_pd *pd,
1172 if (ret) 1172 if (ret)
1173 goto err; 1173 goto err;
1174 1174
1175 qp->real_qp = qp;
1176 qp->qp_type = qp_init_attr->qp_type; 1175 qp->qp_type = qp_init_attr->qp_type;
1177 qp->rwq_ind_tbl = qp_init_attr->rwq_ind_tbl; 1176 qp->rwq_ind_tbl = qp_init_attr->rwq_ind_tbl;
1178 1177