linux/drivers/infiniband/ulp
Carolina Jubran 9a141d3dc8 IB/IPoIB: Avoid restoring OPER_UP after multicast flush
ipoib_ib_dev_flush_light() temporarily clears IPOIB_FLAG_OPER_UP to
prevent multicast joins while ipoib_mcast_dev_flush() is running, and
restores the flag afterwards if it was previously set.

This restore races with ipoib_ib_dev_down(). If the interface is brought
down while the flush is in progress, ipoib_ib_dev_down() clears
IPOIB_FLAG_OPER_UP, but the flush path may set it again after the device
has already gone down.

Since commit 894021a752 ("IB/ipoib: Make the carrier_on_task race
aware"), ipoib_mcast_carrier_on_task() relies on IPOIB_FLAG_OPER_UP
being cleared to terminate its rtnl_trylock() retry loop. If the flag is
left set after shutdown, the workqueue retries forever, causing teardown
to deadlock when ipoib_ndo_uninit() waits in destroy_workqueue() while
holding RTNL.

Instead of overloading IPOIB_FLAG_OPER_UP to block multicast joins
during a light flush, introduce a dedicated IPOIB_FLAG_MCAST_FLUSH flag.
Use it together with IPOIB_FLAG_OPER_UP to determine whether multicast
joins are allowed, avoiding the race with device shutdown.

Fixes: 344bacca8c ("IB/ipoib: Don't allow MC joins during light MC flush")
Reported-by: Ben Davies <ben.davies@gresearch.co.uk>
Signed-off-by: Carolina Jubran <cjubran@nvidia.com>
Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
Signed-off-by: Edward Srouji <edwards@nvidia.com>
Link: https://patch.msgid.link/20260902-avoid-rest-oper-up-v1-1-04fcd4916cae@nvidia.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2026-09-06 02:38:35 -04:00
..
ipoib IB/IPoIB: Avoid restoring OPER_UP after multicast flush 2026-09-06 02:38:35 -04:00
iser IB/iser: reject a remote invalidation of an unregistered direction 2026-09-02 09:08:10 -04:00
isert IB/isert: wait for deferred control PDU completions before releasing the connection 2026-09-02 09:11:10 -04:00
rtrs RDMA/rtrs-clt: Fix CQ pool leak when connect is interrupted 2026-09-03 06:18:46 -04:00
srp RDMA/srp: Fix srp_remove_target() 2026-09-02 08:58:55 -04:00
srpt RDMA/srpt: Pass the mapped task attribute to target_init_cmd() 2026-07-22 02:15:16 -04:00
Makefile RDMA/hfi1: Remove opa_vnic 2026-03-10 07:51:30 -04:00