Skip to content

Commit

Permalink
[IB] Add idr_destroy() calls on module unload
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Roland Dreier committed Oct 24, 2005
1 parent e7d311d commit 5d7edb3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/infiniband/core/cm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions drivers/infiniband/core/sa_query.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions drivers/infiniband/core/ucm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 7 additions & 0 deletions drivers/infiniband/core/uverbs_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5d7edb3

Please sign in to comment.