Re: [PATCH rdma-rc 0/3] RDMA: Prevent RCU callbacks from outliving modules

From: Sebastian Andrzej Siewior

Date: Thu Jul 09 2026 - 06:13:20 EST


On 2026-07-09 12:06:46 [+0300], Leon Romanovsky wrote:
> ib_core, mlx5_ib, and ib_ipoib use call_rcu() with callbacks implemented by
> their modules. Stopping callback producers does not drain callbacks already
> queued. If module unload completes first, RCU can later invoke code that has
> been unloaded. synchronize_rcu() and SRCU waits do not wait for queued
> callbacks.
>
> IPoIB reclamation completions are signaled from inside the callbacks, so
> they can wake teardown before a callback returns. Initialization unwind
> also needs protection because registration can attach existing devices and
> undo their setup on failure.
>
> Wait for queued callbacks after all producers have stopped.
>
> Reported-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> Closes: https://lore.kernel.org/linux-rdma/20260708092316.Qb39F_B0@xxxxxxxxxxxxx/
> Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxx>

Acked-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>

Thank you. This makes sense. drivers/infiniband/hw/hfi1 might need the
same.

However, we do have a little conversation thinking about moving
rcu_barrier() into the module core code but nothing has been decided so
far. I'm trying to figure out how many might be affected by this.

Sebastian