aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Morgenstein <jackm@mellanox.co.il>2006-01-06 19:21:19 -0500
committerRoland Dreier <rolandd@cisco.com>2006-01-06 19:21:19 -0500
commitb4ca1a3f8ca24033d7b7ef595faef97d9f8b2326 (patch)
tree1a45fee6feb7fe3a86a9fc4fbd09fdf32a8f7ae6
parent4de144bf721e46e7ccc8fed45b20a640cc364904 (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.c7
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
490err_unreg: 490err_unreg:
491 ib_dereg_mr(mr); 491 ib_dereg_mr(mr);
492 atomic_dec(&pd->usecnt);
492 493
493err_up: 494err_up:
494 up(&ib_uverbs_idr_mutex); 495 up(&ib_uverbs_idr_mutex);
@@ -935,6 +936,11 @@ err_idr:
935 936
936err_destroy: 937err_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
939err_up: 945err_up:
940 up(&ib_uverbs_idr_mutex); 946 up(&ib_uverbs_idr_mutex);
@@ -1729,6 +1735,7 @@ err_idr:
1729 1735
1730err_destroy: 1736err_destroy:
1731 ib_destroy_srq(srq); 1737 ib_destroy_srq(srq);
1738 atomic_dec(&pd->usecnt);
1732 1739
1733err_up: 1740err_up:
1734 up(&ib_uverbs_idr_mutex); 1741 up(&ib_uverbs_idr_mutex);