[PATCH] RDMA/ucma: Lock the handler in ucma_set_ib_path()
Jason Gunthorpe <[email protected]>
| Newsgroups | dev.linux.lists.patches,org.kernel.vger.linux-rdma,org.kernel.vger.stable |
|---|---|
| Message-ID | <[email protected]> |
ctx->file may only be changed under the handler lock and the xa_lock, which is what stops uevents being queued for a ctx while ucma_migrate_id() moves it to another file. ucma_set_ib_path() was missing this locking prior to calling ucma_event_handler(). Normally ucma_event_handler() would be called from the CM framework with the handler lock already held. Add the missing locking. Cc: [email protected] Fixes: 09e328e47a69 ("RDMA/ucma: Fix the locking of ctx->file") Signed-off-by: Jason Gunthorpe <[email protected]> --- drivers/infiniband/core/ucma.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c index a29f2d4b8d143d..ac29dfa69bb3a6 100644 --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c @@ -1404,7 +1404,10 @@ static int ucma_set_ib_path(struct ucma_context *ctx, memset(&event, 0, sizeof event); event.event = RDMA_CM_EVENT_ROUTE_RESOLVED; - return ucma_event_handler(ctx->cm_id, &event); + rdma_lock_handler(ctx->cm_id); + ret = ucma_event_handler(ctx->cm_id, &event); + rdma_unlock_handler(ctx->cm_id); + return ret; } static int ucma_set_option_ib(struct ucma_context *ctx, int optname, base-commit: f4cc21c6a8e9d392871477f9fd98d68e5ad80272 -- 2.43.0