| From stable-bounces@linux.kernel.org Mon Dec 4 08:50:32 2006 |
| Date: Mon, 4 Dec 2006 18:44:48 +0200 |
| From: Michael S Tsirkin <mst@mellanox.co.il> |
| To: stable@kernel.org, Roland Dreier <rolandd@cisco.com>, Sean Hefty <sean.hefty@intel.com> |
| Message-ID: <20061204164448.GA15375@mellanox.co.il> |
| Subject: 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> |
| Acked-by: Sean Hefty <sean.hefty@intel.com> |
| Signed-off-by: Chris Wright <chrisw@sous-sol.org> |
| --- |
| |
| Hello, -stable team! |
| This patch backports commit f469b2626f48829c06e40ac799c1edf62b12048e to 2.6.19. |
| Please consider it for 2.6.19.y - this fixes a deadlock reproduced here at Mellanox. |
| |
| drivers/infiniband/core/ucm.c | 2 ++ |
| 1 file changed, 2 insertions(+) |
| |
| --- linux-2.6.19.orig/drivers/infiniband/core/ucm.c |
| +++ linux-2.6.19/drivers/infiniband/core/ucm.c |
| @@ -161,12 +161,14 @@ static void ib_ucm_cleanup_events(struct |
| struct ib_ucm_event, ctx_list); |
| list_del(&uevent->file_list); |
| list_del(&uevent->ctx_list); |
| + mutex_unlock(&ctx->file->file_mutex); |
| |
| /* clear incoming connections. */ |
| if (ib_ucm_new_cm_id(uevent->resp.event)) |
| ib_destroy_cm_id(uevent->cm_id); |
| |
| kfree(uevent); |
| + mutex_lock(&ctx->file->file_mutex); |
| } |
| mutex_unlock(&ctx->file->file_mutex); |
| } |