mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roland Dreier <rolandd@cisco.com>
To: linux-kernel@vger.kernel.org, openib-general@openib.org
Subject: [git patch review 7/8] IB/uverbs: Fix reference counting on error paths
Date: Sat, 07 Jan 2006 00:25:42 +0000	[thread overview]
Message-ID: <1136593543000-bf2926ca65fa9af8@cisco.com> (raw)
In-Reply-To: <1136593543000-c8b76b848fc384d6@cisco.com>

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>

---

 drivers/infiniband/core/uverbs_cmd.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

b4ca1a3f8ca24033d7b7ef595faef97d9f8b2326
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index a57d021..6985a57 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -489,6 +489,7 @@ err_idr:
 
 err_unreg:
 	ib_dereg_mr(mr);
+	atomic_dec(&pd->usecnt);
 
 err_up:
 	up(&ib_uverbs_idr_mutex);
@@ -935,6 +936,11 @@ err_idr:
 
 err_destroy:
 	ib_destroy_qp(qp);
+	atomic_dec(&pd->usecnt);
+	atomic_dec(&attr.send_cq->usecnt);
+	atomic_dec(&attr.recv_cq->usecnt);
+	if (attr.srq)
+		atomic_dec(&attr.srq->usecnt);
 
 err_up:
 	up(&ib_uverbs_idr_mutex);
@@ -1729,6 +1735,7 @@ err_idr:
 
 err_destroy:
 	ib_destroy_srq(srq);
+	atomic_dec(&pd->usecnt);
 
 err_up:
 	up(&ib_uverbs_idr_mutex);
-- 
0.99.9n

  reply	other threads:[~2006-01-07  0:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-07  0:25 [git patch review 1/8] IB/mthca: max_inline_data handling tweaks Roland Dreier
2006-01-07  0:25 ` [git patch review 2/8] IB/mthca: fix for SQEr-to-RTS transition in modify QP Roland Dreier
2006-01-07  0:25   ` [git patch review 3/8] IB/mthca: fix for RTR-to-RTS " Roland Dreier
2006-01-07  0:25     ` [git patch review 4/8] IB/mthca: multiple fixes for multicast group handling Roland Dreier
2006-01-07  0:25       ` [git patch review 5/8] IB/mthca: Fill in vendor_err field in completion with error Roland Dreier
2006-01-07  0:25         ` [git patch review 6/8] IB/mthca: Add support for automatic path migration (APM) Roland Dreier
2006-01-07  0:25           ` Roland Dreier [this message]
2006-01-07  0:25             ` [git patch review 8/8] IB/uverbs: set ah_flags when creating address handle Roland Dreier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1136593543000-bf2926ca65fa9af8@cisco.com \
    --to=rolandd@cisco.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openib-general@openib.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®