RDMA/amso1100: Fix memory leak in c2_qp_modify()
authorKrishna Kumar <krkumar2@in.ibm.com>
Mon, 4 Dec 2006 03:44:57 +0000 (09:14 +0530)
committerRoland Dreier <rolandd@cisco.com>
Tue, 12 Dec 2006 19:50:20 +0000 (11:50 -0800)
vq_req is leaked in error cases.

Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/amso1100/c2_qp.c

index 179d005ed4a52f18293f76b432b7117169f64c75..420c1380f5c3f5bddb9534c08621d4869f7e36c7 100644 (file)
@@ -161,8 +161,10 @@ int c2_qp_modify(struct c2_dev *c2dev, struct c2_qp *qp,
 
        if (attr_mask & IB_QP_STATE) {
                /* Ensure the state is valid */
-               if (attr->qp_state < 0 || attr->qp_state > IB_QPS_ERR)
-                       return -EINVAL;
+               if (attr->qp_state < 0 || attr->qp_state > IB_QPS_ERR) {
+                       err = -EINVAL;
+                       goto bail0;
+               }
 
                wr.next_qp_state = cpu_to_be32(to_c2_state(attr->qp_state));
 
@@ -184,9 +186,10 @@ int c2_qp_modify(struct c2_dev *c2dev, struct c2_qp *qp,
                if (attr->cur_qp_state != IB_QPS_RTR &&
                    attr->cur_qp_state != IB_QPS_RTS &&
                    attr->cur_qp_state != IB_QPS_SQD &&
-                   attr->cur_qp_state != IB_QPS_SQE)
-                       return -EINVAL;
-               else
+                   attr->cur_qp_state != IB_QPS_SQE) {
+                       err = -EINVAL;
+                       goto bail0;
+               } else
                        wr.next_qp_state =
                            cpu_to_be32(to_c2_state(attr->cur_qp_state));