diff options
author | Jack Morgenstein <jackm@mellanox.co.il> | 2006-01-06 19:21:19 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-01-06 19:21:19 -0500 |
commit | b4ca1a3f8ca24033d7b7ef595faef97d9f8b2326 (patch) | |
tree | 1a45fee6feb7fe3a86a9fc4fbd09fdf32a8f7ae6 | |
parent | 4de144bf721e46e7ccc8fed45b20a640cc364904 (diff) |
IB/uverbs: Fix reference counting on error paths
If an operation fails after incrementing an object's reference count,
then it should decrement the reference count on the error path.
Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r-- | drivers/infiniband/core/uverbs_cmd.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index a57d021d435a..6985a57fa6ae 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c | |||
@@ -489,6 +489,7 @@ err_idr: | |||
489 | 489 | ||
490 | err_unreg: | 490 | err_unreg: |
491 | ib_dereg_mr(mr); | 491 | ib_dereg_mr(mr); |
492 | atomic_dec(&pd->usecnt); | ||
492 | 493 | ||
493 | err_up: | 494 | err_up: |
494 | up(&ib_uverbs_idr_mutex); | 495 | up(&ib_uverbs_idr_mutex); |
@@ -935,6 +936,11 @@ err_idr: | |||
935 | 936 | ||
936 | err_destroy: | 937 | err_destroy: |
937 | ib_destroy_qp(qp); | 938 | ib_destroy_qp(qp); |
939 | atomic_dec(&pd->usecnt); | ||
940 | atomic_dec(&attr.send_cq->usecnt); | ||
941 | atomic_dec(&attr.recv_cq->usecnt); | ||
942 | if (attr.srq) | ||
943 | atomic_dec(&attr.srq->usecnt); | ||
938 | 944 | ||
939 | err_up: | 945 | err_up: |
940 | up(&ib_uverbs_idr_mutex); | 946 | up(&ib_uverbs_idr_mutex); |
@@ -1729,6 +1735,7 @@ err_idr: | |||
1729 | 1735 | ||
1730 | err_destroy: | 1736 | err_destroy: |
1731 | ib_destroy_srq(srq); | 1737 | ib_destroy_srq(srq); |
1738 | atomic_dec(&pd->usecnt); | ||
1732 | 1739 | ||
1733 | err_up: | 1740 | err_up: |
1734 | up(&ib_uverbs_idr_mutex); | 1741 | up(&ib_uverbs_idr_mutex); |