* [PATCH net v4] dibs: loopback: reset the client id when the owner unregisters a DMB
@ 2026-12-03 5:53 Bryam Vargas via B4 Relay
2026-12-03 5:59 ` netdev-bot+sinfo
0 siblings, 1 reply; 2+ messages in thread
From: Bryam Vargas via B4 Relay @ 2026-12-03 5:53 UTC (permalink / raw)
To: Alexandra Winter, Dust Li, Paolo Abeni, David S. Miller,
D. Wythe, Sidraya Jayagond, Eric Dumazet, Jakub Kicinski,
Mahanta Jambigi
Cc: linux-rdma, Tony Lu, Hidayath Khan, Julian Ruess, linux-s390,
Wen Gu, linux-kernel, Wenjia Zhang, netdev, Simon Horman
From: Bryam Vargas <hexlabsecurity@proton.me>
dibs_lo_unregister_dmb() resets the DMB's dmb_clientid_arr[] entry only
on the last put. If an attacher still holds the DMB, as when an SMC link
group is freed while a peer is still attached, the entry stays set after
the attacher's dibs_lo_detach_dmb() frees the DMB.
dibs_unregister_client() then warns at rmmod smc and returns -EBUSY,
which smc_ism_exit() ignores: smc stays in clients[] and dibs->subs[],
and a later dibs_dev_add() or dibs_dev_del() (rmmod dibs, ISM hotplug)
calls into the unloaded module.
Reset the entry when the owner unregisters, before its put, as
ism_unregister_dmb() does. The index stays allocated until the last put,
and the attacher's writes no longer raise an interrupt for a client that
gave the DMB up.
Fixes: cc21191b584c ("dibs: Move data path to dibs layer")
Cc: stable@vger.kernel.org
Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
---
v4 is 1/2 of v3 alone, as Alexandra proposed [1]. 2/2 ("net/smc: do
not reuse the DMB of a nocopy device") is not in this posting: the
question of the reuse pool is open, and Sashiko flagged a stale
descriptor in 2/2 [2]. This patch does not depend on 2/2.
On net, when a link group is freed while a peer still holds one of
its DMBs, rmmod smc warns in dibs_unregister_client(), with the DMB's
entry still set. With this patch alone the entry is reset, rmmod does
not warn, and smc loads and connects again. x86 KVM guest, KASAN,
v7.4-rc2, with net/smc and drivers/dibs from net built as modules
with test counters; a test-only knob cut the 600 s link group free
delay to 3 s. Not run again for v4: the patch is unchanged, and so are
drivers/dibs and net/smc on net since that run.
Test patch and logs on request.
v4:
- 2/2 left out; no change to this patch.
- On net c1c39137dcc3.
v3: https://lore.kernel.org/all/20261128-b4-disp-2c190c90-v3-0-c566f64196c8@proton.me/
v2: https://lore.kernel.org/all/20261114-b4-disp-4e6374c2-v2-0-3b7050bddef7@proton.me/
v1: https://lore.kernel.org/all/20261113-b4-disp-19244662-v1-0-39b256b70ca7@proton.me/
[1] https://lore.kernel.org/all/25c88570-8cd6-4058-b82e-cde76dd6cac8@linux.ibm.com/
[2] https://lore.kernel.org/all/sashiko-outbox-239731@kernel.org/
---
drivers/dibs/dibs_loopback.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/dibs/dibs_loopback.c b/drivers/dibs/dibs_loopback.c
index 44a2e74c2efc..566e61a013d0 100644
--- a/drivers/dibs/dibs_loopback.c
+++ b/drivers/dibs/dibs_loopback.c
@@ -138,6 +138,13 @@ static int dibs_lo_unregister_dmb(struct dibs_dev *dibs, struct dibs_dmb *dmb)
ldev = dibs->drv_priv;
+ /* Reset before the owner's put: after it, an attacher's detach can
+ * free the index for a new DMB.
+ */
+ spin_lock_irqsave(&dibs->lock, flags);
+ dibs->dmb_clientid_arr[dmb->idx] = NO_DIBS_CLIENT;
+ spin_unlock_irqrestore(&dibs->lock, flags);
+
/* find dmb from hash table */
write_lock_bh(&ldev->dmb_ht_lock);
hash_for_each_possible(ldev->dmb_ht, tmp_node, list, dmb->dmb_tok) {
@@ -155,13 +162,8 @@ static int dibs_lo_unregister_dmb(struct dibs_dev *dibs, struct dibs_dmb *dmb)
hash_del(&dmb_node->list);
write_unlock_bh(&ldev->dmb_ht_lock);
- if (last) {
- spin_lock_irqsave(&dibs->lock, flags);
- dibs->dmb_clientid_arr[dmb_node->sba_idx] = NO_DIBS_CLIENT;
- spin_unlock_irqrestore(&dibs->lock, flags);
-
+ if (last)
dibs_lo_free_dmb(ldev, dmb_node);
- }
return 0;
}
---
base-commit: c1c39137dcc3134010566ff29a81c93124efa539
change-id: 20261203-b4-disp-b330a4df-0ab5c32480d6
Best regards,
--
Bryam Vargas <hexlabsecurity@proton.me>
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH net v4] dibs: loopback: reset the client id when the owner unregisters a DMB
2026-12-03 5:53 [PATCH net v4] dibs: loopback: reset the client id when the owner unregisters a DMB Bryam Vargas via B4 Relay
@ 2026-12-03 5:59 ` netdev-bot+sinfo
0 siblings, 0 replies; 2+ messages in thread
From: netdev-bot+sinfo @ 2026-12-03 5:59 UTC (permalink / raw)
To: Bryam Vargas
Cc: Alexandra Winter, Dust Li, Paolo Abeni, David S. Miller,
D. Wythe, Sidraya Jayagond, Eric Dumazet, Jakub Kicinski,
Mahanta Jambigi, linux-rdma, Tony Lu, Hidayath Khan,
Julian Ruess, linux-s390, Wen Gu, linux-kernel, Wenjia Zhang,
netdev, Simon Horman
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during
development, syzbot report, manual code inspection, LLM or static
analysis tool scan.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.
*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
--
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-03 5:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-03 5:53 [PATCH net v4] dibs: loopback: reset the client id when the owner unregisters a DMB Bryam Vargas via B4 Relay
2026-12-03 5:59 ` netdev-bot+sinfo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®