[IB] Add idr_destroy() calls on module unload
authorRoland Dreier <rolandd@cisco.com>
Mon, 24 Oct 2005 17:53:25 +0000 (10:53 -0700)
committerRoland Dreier <rolandd@cisco.com>
Mon, 24 Oct 2005 17:53:25 +0000 (10:53 -0700)
Add idr_destroy() calls to the module_exit() functions of the four IB
driver modules that use idrs, so we don't leak idr_layer_cache objects
when these modules are unloaded.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/core/cm.c
drivers/infiniband/core/sa_query.c
drivers/infiniband/core/ucm.c
drivers/infiniband/core/uverbs_main.c

index 54db6d4831f1abd922651436c4fd07a36ad53a92..151ef83cc14f32bcddede4f9708ebc3d42eb5ee8 100644 (file)
@@ -3323,6 +3323,7 @@ static void __exit ib_cm_cleanup(void)
        flush_workqueue(cm.wq);
        destroy_workqueue(cm.wq);
        ib_unregister_client(&cm_client);
+       idr_destroy(&cm.local_id_table);
 }
 
 module_init(ib_cm_init);
index 262618210c1c6d7db2924dca0f67f768ea6c20b3..e215cf0478d666d66881f1145d9989d65076f3e2 100644 (file)
@@ -975,6 +975,7 @@ static int __init ib_sa_init(void)
 static void __exit ib_sa_cleanup(void)
 {
        ib_unregister_client(&sa_client);
+       idr_destroy(&query_idr);
 }
 
 module_init(ib_sa_init);
index d0f0b0a2edd33820803654622a5852152502fa5a..5a6ba4030d44f60869b9789a47ab2e61a9d0629d 100644 (file)
@@ -1320,6 +1320,7 @@ static void __exit ib_ucm_cleanup(void)
        class_destroy(ib_ucm_class);
        cdev_del(&ib_ucm_cdev);
        unregister_chrdev_region(IB_UCM_DEV, 1);
+       idr_destroy(&ctx_id_table);
 }
 
 module_init(ib_ucm_init);
index 12511808de212673ebb5a1f6173b0f3b40155cbe..add45f7faa5b6d3267eee920bf9a8d2e02e935e0 100644 (file)
@@ -762,6 +762,13 @@ static void __exit ib_uverbs_cleanup(void)
        unregister_filesystem(&uverbs_event_fs);
        class_unregister(&uverbs_class);
        unregister_chrdev_region(IB_UVERBS_BASE_DEV, IB_UVERBS_MAX_DEVICES);
+       idr_destroy(&ib_uverbs_pd_idr);
+       idr_destroy(&ib_uverbs_mr_idr);
+       idr_destroy(&ib_uverbs_mw_idr);
+       idr_destroy(&ib_uverbs_ah_idr);
+       idr_destroy(&ib_uverbs_cq_idr);
+       idr_destroy(&ib_uverbs_qp_idr);
+       idr_destroy(&ib_uverbs_srq_idr);
 }
 
 module_init(ib_uverbs_init);