[openib-general] [PATCH] uverbs: error handling fixes

Michael S. Tsirkin mst at mellanox.co.il
Tue Dec 27 01:11:54 PST 2005


uverbs: fix reference counting in error handling.

Signed-off-by: Jack Morgenstein <jackm at mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>

Index: linux-kernel/drivers/infiniband/core/uverbs_cmd.c
===================================================================
--- linux-kernel/drivers/infiniband/core/uverbs_cmd.c	(revision 4611)
+++ linux-kernel/drivers/infiniband/core/uverbs_cmd.c	(working copy)
@@ -488,6 +488,7 @@ err_idr:
 	idr_remove(&ib_uverbs_mr_idr, obj->uobject.id);
 
 err_unreg:
+	atomic_dec(&pd->usecnt);
 	ib_dereg_mr(mr);
 
 err_up:
@@ -934,6 +935,11 @@ err_idr:
 	idr_remove(&ib_uverbs_qp_idr, uobj->uevent.uobject.id);
 
 err_destroy:
+	atomic_dec(&pd->usecnt);
+	atomic_dec(&attr.send_cq->usecnt);
+	atomic_dec(&attr.recv_cq->usecnt);
+	if (attr.srq)
+		atomic_dec(&attr.srq->usecnt);
 	ib_destroy_qp(qp);
 
 err_up:
@@ -1728,6 +1734,7 @@ err_idr:
 	idr_remove(&ib_uverbs_srq_idr, uobj->uobject.id);
 
 err_destroy:
+	atomic_dec(&pd->usecnt);
 	ib_destroy_srq(srq);
 
 err_up:

-- 
MST



More information about the general mailing list