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

From: Dave Jiang

Date: Thu Sep 24 2026 - 12:08:27 EST




On 9/9/26 9:08 PM, Koichiro Den wrote:
> 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>

Reviewed-by: Dave Jiang <dave.jiang@xxxxxxxxx>

> ---
> 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);
> }
>