RDMA/rxe: Fix race in rxe_mcast.c
authorBob Pearson <rpearsonhpe@gmail.com>
Wed, 16 Dec 2020 23:15:50 +0000 (17:15 -0600)
committerJason Gunthorpe <jgg@nvidia.com>
Tue, 12 Jan 2021 20:35:39 +0000 (16:35 -0400)
commit8a48ac7f6c24973863b42d03156d5e34c46c2971
treed97164eec02cad45747b5c72e0cf092469cae9a6
parent3853c35e243d56238159e8365b6aca410bdd4576
RDMA/rxe: Fix race in rxe_mcast.c

Fix a race in rxe_mcast.c that occurs when two QPs try at the same time to
attach a multicast address. Both QPs lookup the mgid address in a pool of
multicast groups and if they do not find it create a new group elem.

Fix this by locking the lookup/alloc/add key sequence and using the
unlocked APIs added in this patch set.

Link: https://lore.kernel.org/r/20201216231550.27224-8-rpearson@hpe.com
Signed-off-by: Bob Pearson <rpearson@hpe.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/sw/rxe/rxe_mcast.c