aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/nes
diff options
context:
space:
mode:
authorFaisal Latif <faisal.latif@intel.com>2009-04-27 16:45:19 -0400
committerRoland Dreier <rolandd@cisco.com>2009-04-27 16:45:19 -0400
commit9256b2513074164b4555617c4a3b82d36abf03e5 (patch)
treeffccbec443c56132035336ef80f65759947beb62 /drivers/infiniband/hw/nes
parent109d67e4f12b828113ca8ccf4a735972dd984f40 (diff)
RDMA/nes: Fix error path in nes_accept()
If reg_phys_mem() fails, we need to free memory allocated for MPA frame with private data before returning the error. Also move nes_add_ref() after the reg_phys_mem() is successful. Signed-off-by: Faisal Latif <faisal.latif@intel.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/nes')
-rw-r--r--drivers/infiniband/hw/nes/nes_cm.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
index 2c90b38daef1..11c7d6642014 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -2705,7 +2705,6 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
2705 /* associate the node with the QP */ 2705 /* associate the node with the QP */
2706 nesqp->cm_node = (void *)cm_node; 2706 nesqp->cm_node = (void *)cm_node;
2707 cm_node->nesqp = nesqp; 2707 cm_node->nesqp = nesqp;
2708 nes_add_ref(&nesqp->ibqp);
2709 2708
2710 nes_debug(NES_DBG_CM, "QP%u, cm_node=%p, jiffies = %lu listener = %p\n", 2709 nes_debug(NES_DBG_CM, "QP%u, cm_node=%p, jiffies = %lu listener = %p\n",
2711 nesqp->hwqp.qp_id, cm_node, jiffies, cm_node->listener); 2710 nesqp->hwqp.qp_id, cm_node, jiffies, cm_node->listener);
@@ -2758,6 +2757,9 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
2758 nes_debug(NES_DBG_CM, "Unable to register memory region" 2757 nes_debug(NES_DBG_CM, "Unable to register memory region"
2759 "for lSMM for cm_node = %p \n", 2758 "for lSMM for cm_node = %p \n",
2760 cm_node); 2759 cm_node);
2760 pci_free_consistent(nesdev->pcidev,
2761 nesqp->private_data_len+sizeof(struct ietf_mpa_frame),
2762 nesqp->ietf_frame, nesqp->ietf_frame_pbase);
2761 return -ENOMEM; 2763 return -ENOMEM;
2762 } 2764 }
2763 2765
@@ -2874,6 +2876,7 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
2874 2876
2875 /* notify OF layer that accept event was successful */ 2877 /* notify OF layer that accept event was successful */
2876 cm_id->add_ref(cm_id); 2878 cm_id->add_ref(cm_id);
2879 nes_add_ref(&nesqp->ibqp);
2877 2880
2878 cm_event.event = IW_CM_EVENT_ESTABLISHED; 2881 cm_event.event = IW_CM_EVENT_ESTABLISHED;
2879 cm_event.status = IW_CM_EVENT_STATUS_ACCEPTED; 2882 cm_event.status = IW_CM_EVENT_STATUS_ACCEPTED;