mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] NTB/msi: fix error cleanup mw index in ntb_msi_setup_mws()
@ 2026-11-20  8:40 zhangjiao2
  2026-11-25  5:36 ` Koichiro Den
  0 siblings, 1 reply; 2+ messages in thread
From: zhangjiao2 @ 2026-11-20  8:40 UTC (permalink / raw)
  To: linux; +Cc: jdmason, linux-kernel, trivial, zhang jiao

From: zhang jiao <zhangjiao2@cmss.chinamobile.com>

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@cmss.chinamobile.com>
---
 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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] NTB/msi: fix error cleanup mw index in ntb_msi_setup_mws()
  2026-11-20  8:40 [PATCH] NTB/msi: fix error cleanup mw index in ntb_msi_setup_mws() zhangjiao2
@ 2026-11-25  5:36 ` Koichiro Den
  0 siblings, 0 replies; 2+ messages in thread
From: Koichiro Den @ 2026-11-25  5:36 UTC (permalink / raw)
  To: zhangjiao2; +Cc: ntb, linux, jdmason, linux-kernel, trivial

On Fri, Nov 20, 2026 at 04:40:39PM +0800, zhangjiao2 wrote:
> From: zhang jiao <zhangjiao2@cmss.chinamobile.com>
> 
> 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@cmss.chinamobile.com>

I suppose the Fixes tag should be added, shouldn't it?

  Fixes: 26b3a37b9284 ("NTB: Introduce MSI library")

Otherwise, LGTM.

Reviewed-by: Koichiro Den <den@valinux.co.jp>

> ---
>  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
> 
> 
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-25  5:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-20  8:40 [PATCH] NTB/msi: fix error cleanup mw index in ntb_msi_setup_mws() zhangjiao2
2026-11-25  5:36 ` Koichiro Den

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®