RDMA/rxe: Fix memory allocation while in a spin lock
authorBob Pearson <rpearsonhpe@gmail.com>
Fri, 13 Aug 2021 21:06:26 +0000 (16:06 -0500)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 19 Aug 2021 23:11:16 +0000 (20:11 -0300)
commit65a81b61d8c5e96748671824cc46339afbd831d0
tree51fd7ed863c378a2cbe38e4af7055dc2744341b4
parenta036ad088306a88de87e973981f2b9224e466c3f
RDMA/rxe: Fix memory allocation while in a spin lock

rxe_mcast_add_grp_elem() in rxe_mcast.c calls rxe_alloc() while holding
spinlocks which in turn calls kzalloc(size, GFP_KERNEL) which is
incorrect.  This patch replaces rxe_alloc() by rxe_alloc_locked() which
uses GFP_ATOMIC.  This bug was caused by the below mentioned commit and
failing to handle the need for the atomic allocate.

Fixes: 4276fd0dddc9 ("RDMA/rxe: Remove RXE_POOL_ATOMIC")
Link: https://lore.kernel.org/r/20210813210625.4484-1-rpearsonhpe@gmail.com
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/sw/rxe/rxe_mcast.c