RDMA/cxgb4: Fix over-dereference when terminating
[linux-2.6-block.git] / drivers / infiniband / hw / cxgb4 / qp.c
index 5a7d368aa47a1e41a27fe6c3384c1e3680e551de..7b5114cb486f64f118beb7f2415ad415d75f40ae 100644 (file)
@@ -1389,6 +1389,7 @@ int c4iw_modify_qp(struct c4iw_dev *rhp, struct c4iw_qp *qhp,
                        qhp->attr.ecode = attrs->ecode;
                        ep = qhp->ep;
                        disconnect = 1;
+                       c4iw_get_ep(&qhp->ep->com);
                        if (!internal)
                                terminate = 1;
                        else {
@@ -1396,7 +1397,6 @@ int c4iw_modify_qp(struct c4iw_dev *rhp, struct c4iw_qp *qhp,
                                if (ret)
                                        goto err;
                        }
-                       c4iw_get_ep(&qhp->ep->com);
                        break;
                case C4IW_QP_STATE_ERROR:
                        t4_set_wq_in_error(&qhp->wq);