Re: [PATCH] NTB/msi: fix error cleanup mw index in ntb_msi_setup_mws()
From: Koichiro Den
Date: Wed Nov 25 2026 - 00:36:26 EST
On Fri, Nov 20, 2026 at 04:40:39PM +0800, zhangjiao2 wrote:
> From: zhang jiao <zhangjiao2@xxxxxxxxxxxxxxxxxxxx>
>
> In the error_out cleanup path of ntb_msi_setup_mws(), the loop
> iterates over the peers configured so far using the loop variable
> 'i', but ntb_peer_highest_mw_idx() is incorrectly passed 'peer'
> (the index of the peer whose setup just failed) instead of 'i'.
> As a result every iteration looks up the highest memory window of
> the failing peer, so ntb_mw_clear_trans() clears the wrong window
> index for each configured peer and the intended translations are
> left enabled.
>
> Fix it by passing the correct loop index 'i'.
>
> Signed-off-by: zhang jiao <zhangjiao2@xxxxxxxxxxxxxxxxxxxx>
I suppose the Fixes tag should be added, shouldn't it?
Fixes: 26b3a37b9284 ("NTB: Introduce MSI library")
Otherwise, LGTM.
Reviewed-by: Koichiro Den <den@xxxxxxxxxxxxx>
> ---
> drivers/ntb/msi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/ntb/msi.c b/drivers/ntb/msi.c
> index 6817d504c12a..13e9f52ec8cc 100644
> --- a/drivers/ntb/msi.c
> +++ b/drivers/ntb/msi.c
> @@ -154,7 +154,7 @@ int ntb_msi_setup_mws(struct ntb_dev *ntb)
>
> error_out:
> for (i = 0; i < peer; i++) {
> - peer_widx = ntb_peer_highest_mw_idx(ntb, peer);
> + peer_widx = ntb_peer_highest_mw_idx(ntb, i);
> if (peer_widx < 0)
> continue;
>
> --
> 2.33.0
>
>
>