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@vger.kernel.org Reviewed-by: Logan Gunthorpe Reviewed-by: Dave Jiang Signed-off-by: Koichiro Den --- Changes in v3: - Add Reviewed-by tag. No code changes. 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 9f23c9c3d220..af7f240479f4 100644 --- a/drivers/ntb/ntb_transport.c +++ b/drivers/ntb/ntb_transport.c @@ -1149,7 +1149,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