]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
RDMA/ucma: Add missing locking around rdma_leave_multicast()
authorJason Gunthorpe <jgg@nvidia.com>
Tue, 18 Aug 2020 12:05:22 +0000 (15:05 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 09:07:52 +0000 (10:07 +0100)
[ Upstream commit 38e03d092699891c3237b5aee9e8029d4ede0956 ]

All entry points to the rdma_cm from a ULP must be single threaded,
even this error unwinds. Add the missing locking.

Fixes: 7c11910783a1 ("RDMA/ucma: Put a lock around every call to the rdma_cm layer")
Link: https://lore.kernel.org/r/20200818120526.702120-11-leon@kernel.org
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/core/ucma.c

index cf283b70bf8776fc3ff6a5656db3116905975a6f..2643d5dbe1da87200a930ea70808fa2e15546cac 100644 (file)
@@ -1512,7 +1512,9 @@ static ssize_t ucma_process_join(struct ucma_file *file,
        return 0;
 
 err3:
+       mutex_lock(&ctx->mutex);
        rdma_leave_multicast(ctx->cm_id, (struct sockaddr *) &mc->addr);
+       mutex_unlock(&ctx->mutex);
        ucma_cleanup_mc_events(mc);
 err2:
        xa_erase(&multicast_table, mc->id);