On Thu, Feb 17, 2022 at 06:35:39PM -0600, Bob Pearson wrote: > Well behaved applications will free all memory allocated by multicast. > If this fails rdma-core will detach all qp's from multicast groups when > an application terminates. This patch prints a warning and cleans out > memory allocated by multicast if both of these fail to occur. > > Signed-off-by: Bob Pearson <rpearsonhpe@xxxxxxxxx> > drivers/infiniband/sw/rxe/rxe.c | 2 ++ > drivers/infiniband/sw/rxe/rxe_loc.h | 1 + > drivers/infiniband/sw/rxe/rxe_mcast.c | 38 +++++++++++++++++++++++++++ > 3 files changed, 41 insertions(+) > > diff --git a/drivers/infiniband/sw/rxe/rxe.c b/drivers/infiniband/sw/rxe/rxe.c > index 3520eb2db685..603b0156f889 100644 > +++ b/drivers/infiniband/sw/rxe/rxe.c > @@ -29,6 +29,8 @@ void rxe_dealloc(struct ib_device *ib_dev) > rxe_pool_cleanup(&rxe->mr_pool); > rxe_pool_cleanup(&rxe->mw_pool); > > + rxe_cleanup_mcast(rxe); Lets just put WARN_ON(!RB_EMPTY_ROOT(&rxe->mcg_tree)); Righ here and forget about there rest. Leaking memory if the kernel is buggy is OK. Jason