]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
IB/core: Set qp->real_qp before it may be accessed
authorArtemy Kovalyov <artemyko@mellanox.com>
Wed, 1 May 2019 05:39:48 +0000 (08:39 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Fri, 3 May 2019 13:17:45 +0000 (10:17 -0300)
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>
drivers/infiniband/core/core_priv.h
drivers/infiniband/core/uverbs_cmd.c
drivers/infiniband/core/verbs.c

index d4dd360769cbbe075ef6eeb24c69ee2e4c7084b6..2764647056d8fd1127324068d92506e51ee806d7 100644 (file)
@@ -304,6 +304,7 @@ static inline struct ib_qp *_ib_create_qp(struct ib_device *dev,
        qp->device = dev;
        qp->pd = pd;
        qp->uobject = uobj;
+       qp->real_qp = qp;
        /*
         * We don't track XRC QPs for now, because they don't have PD
         * and more importantly they are created internaly by driver,
index 76ac113d1da5b0fbbdaa78c7f2415d0aaba873bc..5a3a1780ceea4d47efcdcc022b0f72fd1e194e8b 100644 (file)
@@ -1418,7 +1418,6 @@ static int create_qp(struct uverbs_attr_bundle *attrs,
                if (ret)
                        goto err_cb;
 
-               qp->real_qp       = qp;
                qp->pd            = pd;
                qp->send_cq       = attr.send_cq;
                qp->recv_cq       = attr.recv_cq;
index 7313edc9f091798332b8d266f8026f36e4f55051..d607c319ad5028b04bf251cdfd95de6556ab5115 100644 (file)
@@ -1172,7 +1172,6 @@ struct ib_qp *ib_create_qp_user(struct ib_pd *pd,
        if (ret)
                goto err;
 
-       qp->real_qp    = qp;
        qp->qp_type    = qp_init_attr->qp_type;
        qp->rwq_ind_tbl = qp_init_attr->rwq_ind_tbl;