diff options
author | Ralph Campbell <ralph.campbell@qlogic.com> | 2007-11-14 15:09:05 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-11-20 14:04:10 -0500 |
commit | 8a278e6d571ebe10b96f2b53c74f01fd0a3f005a (patch) | |
tree | 3d6ced2d41c7aa6d0db91e1141b943f202a93c64 /drivers/infiniband | |
parent | fb74dacb0f00dff851c78411773a5bd5d7128b81 (diff) |
IB/ipath: Fix error path in QP creation
This patch fixes the code which frees the partially allocated QP
resources if there was an error while creating the QP. In particular,
the QPN wasn't deallocated and the QP wasn't removed from the hash
table.
Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_qp.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_qp.c b/drivers/infiniband/hw/ipath/ipath_qp.c index 6a41fdbc8e57..b997ff88401b 100644 --- a/drivers/infiniband/hw/ipath/ipath_qp.c +++ b/drivers/infiniband/hw/ipath/ipath_qp.c | |||
@@ -835,7 +835,8 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, | |||
835 | init_attr->qp_type); | 835 | init_attr->qp_type); |
836 | if (err) { | 836 | if (err) { |
837 | ret = ERR_PTR(err); | 837 | ret = ERR_PTR(err); |
838 | goto bail_rwq; | 838 | vfree(qp->r_rq.wq); |
839 | goto bail_qp; | ||
839 | } | 840 | } |
840 | qp->ip = NULL; | 841 | qp->ip = NULL; |
841 | ipath_reset_qp(qp); | 842 | ipath_reset_qp(qp); |
@@ -863,7 +864,7 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, | |||
863 | sizeof(offset)); | 864 | sizeof(offset)); |
864 | if (err) { | 865 | if (err) { |
865 | ret = ERR_PTR(err); | 866 | ret = ERR_PTR(err); |
866 | goto bail_rwq; | 867 | goto bail_ip; |
867 | } | 868 | } |
868 | } else { | 869 | } else { |
869 | u32 s = sizeof(struct ipath_rwq) + | 870 | u32 s = sizeof(struct ipath_rwq) + |
@@ -875,7 +876,7 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, | |||
875 | qp->r_rq.wq); | 876 | qp->r_rq.wq); |
876 | if (!qp->ip) { | 877 | if (!qp->ip) { |
877 | ret = ERR_PTR(-ENOMEM); | 878 | ret = ERR_PTR(-ENOMEM); |
878 | goto bail_rwq; | 879 | goto bail_ip; |
879 | } | 880 | } |
880 | 881 | ||
881 | err = ib_copy_to_udata(udata, &(qp->ip->offset), | 882 | err = ib_copy_to_udata(udata, &(qp->ip->offset), |
@@ -907,9 +908,11 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, | |||
907 | goto bail; | 908 | goto bail; |
908 | 909 | ||
909 | bail_ip: | 910 | bail_ip: |
910 | kfree(qp->ip); | 911 | if (qp->ip) |
911 | bail_rwq: | 912 | kref_put(&qp->ip->ref, ipath_release_mmap_info); |
912 | vfree(qp->r_rq.wq); | 913 | else |
914 | vfree(qp->r_rq.wq); | ||
915 | ipath_free_qp(&dev->qp_table, qp); | ||
913 | bail_qp: | 916 | bail_qp: |
914 | kfree(qp); | 917 | kfree(qp); |
915 | bail_swq: | 918 | bail_swq: |