[PATCH v2 13/14] NTB: ntb_transport: Abort link setup on QP MW allocation failure

From: Koichiro Den

Date: Thu Sep 10 2026 - 00:11:08 EST


ntb_transport_setup_qp_mw() can fail while growing a QP's RX entry pool,
but the link worker ignores that error. The worker can consequently
publish a QP whose memory-window state is only partly initialized.

Abort on the first QP setup error and release the MWs through the
existing error path instead of publishing the transport link.

Fixes: a754a8fcaf38 ("NTB: allocate number transport entries depending on size of ring size")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Koichiro Den <den@xxxxxxxxxxxxx>
---
Changes in v2:
- No changes.

Originally submitted as part of the direct TX/RX series v1:
https://lore.kernel.org/r/20260810165136.2292436-2-den@xxxxxxxxxxxxx/

drivers/ntb/ntb_transport.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
index 096be87e5ede..c1e3a077c45e 100644
--- a/drivers/ntb/ntb_transport.c
+++ b/drivers/ntb/ntb_transport.c
@@ -1152,7 +1152,9 @@ static void ntb_transport_link_work(struct work_struct *work)
}

for (i = 0; i < nt->qp_count; i++) {
- ntb_transport_setup_qp_mw(nt, i);
+ rc = ntb_transport_setup_qp_mw(nt, i);
+ if (rc)
+ goto out1;
ntb_transport_setup_qp_peer_msi(nt, i);
}

--
2.51.0