diff options
author | Michael S. Tsirkin <mst@mellanox.co.il> | 2006-11-29 18:33:10 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-11-29 18:33:10 -0500 |
commit | f469b2626f48829c06e40ac799c1edf62b12048e (patch) | |
tree | 425a3a94af73ed41c7eb28a0ad50d411bc545663 /drivers/infiniband | |
parent | e1444b5a163e81138754cab27c4fa1637b5a2239 (diff) |
IB/ucm: Fix deadlock in cleanup
ib_ucm_cleanup_events() holds file_mutex while calling ib_destroy_cm_id().
This can deadlock since ib_destroy_cm_id() flushes event handlers, and
ib_ucm_event_handler() needs file_mutex, too. Therefore, drop the
file_mutex during the call to ib_destroy_cm_id().
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/core/ucm.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c index 1f4f2d2cfa2..f15220a0ee7 100644 --- a/drivers/infiniband/core/ucm.c +++ b/drivers/infiniband/core/ucm.c | |||
@@ -161,12 +161,14 @@ static void ib_ucm_cleanup_events(struct ib_ucm_context *ctx) | |||
161 | struct ib_ucm_event, ctx_list); | 161 | struct ib_ucm_event, ctx_list); |
162 | list_del(&uevent->file_list); | 162 | list_del(&uevent->file_list); |
163 | list_del(&uevent->ctx_list); | 163 | list_del(&uevent->ctx_list); |
164 | mutex_unlock(&ctx->file->file_mutex); | ||
164 | 165 | ||
165 | /* clear incoming connections. */ | 166 | /* clear incoming connections. */ |
166 | if (ib_ucm_new_cm_id(uevent->resp.event)) | 167 | if (ib_ucm_new_cm_id(uevent->resp.event)) |
167 | ib_destroy_cm_id(uevent->cm_id); | 168 | ib_destroy_cm_id(uevent->cm_id); |
168 | 169 | ||
169 | kfree(uevent); | 170 | kfree(uevent); |
171 | mutex_lock(&ctx->file->file_mutex); | ||
170 | } | 172 | } |
171 | mutex_unlock(&ctx->file->file_mutex); | 173 | mutex_unlock(&ctx->file->file_mutex); |
172 | } | 174 | } |