netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mctp: Fix incorrect tx flow invalidation condition in mctp-i2c
@ 2025-03-25  8:10 Daniel Hsu
  2025-03-25  8:30 ` Jeremy Kerr
  2025-03-26 13:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel Hsu @ 2025-03-25  8:10 UTC (permalink / raw)
  To: jk
  Cc: matt, andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel, Daniel Hsu

Previously, the condition for invalidating the tx flow in
mctp_i2c_invalidate_tx_flow() checked if `rc` was nonzero.
However, this could incorrectly trigger the invalidation
even when `rc > 0` was returned as a success status.

This patch updates the condition to explicitly check for `rc < 0`,
ensuring that only error cases trigger the invalidation.

Signed-off-by: Daniel Hsu <Daniel-Hsu@quantatw.com>
---
 drivers/net/mctp/mctp-i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mctp/mctp-i2c.c b/drivers/net/mctp/mctp-i2c.c
index d74d47dd6e04..f782d93f826e 100644
--- a/drivers/net/mctp/mctp-i2c.c
+++ b/drivers/net/mctp/mctp-i2c.c
@@ -537,7 +537,7 @@ static void mctp_i2c_xmit(struct mctp_i2c_dev *midev, struct sk_buff *skb)
 		rc = __i2c_transfer(midev->adapter, &msg, 1);
 
 		/* on tx errors, the flow can no longer be considered valid */
-		if (rc)
+		if (rc < 0)
 			mctp_i2c_invalidate_tx_flow(midev, skb);
 
 		break;
-- 
2.25.1


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

* Re: [PATCH] mctp: Fix incorrect tx flow invalidation condition in mctp-i2c
  2025-03-25  8:10 [PATCH] mctp: Fix incorrect tx flow invalidation condition in mctp-i2c Daniel Hsu
@ 2025-03-25  8:30 ` Jeremy Kerr
  2025-03-26 13:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Jeremy Kerr @ 2025-03-25  8:30 UTC (permalink / raw)
  To: Daniel Hsu
  Cc: matt, andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel, Daniel Hsu

Hi Daniel,

> Previously, the condition for invalidating the tx flow in
> mctp_i2c_invalidate_tx_flow() checked if `rc` was nonzero.
> However, this could incorrectly trigger the invalidation
> even when `rc > 0` was returned as a success status.

Yes, and we should be seeing rc > 0 in normal behaviour...

> This patch updates the condition to explicitly check for `rc < 0`,
> ensuring that only error cases trigger the invalidation.

Looks good to me. I'll do some testing in my environment here, but in
the meantime:

Reviewed-by: Jeremy Kerr <jk@codeconstruct.com.au>

I figure you'll want to target the net (not net-next) tree, in which
case you'll probably need this:

Fixes: 338a93cf4a18 ("net: mctp-i2c: invalidate flows immediately on TX errors")

Thanks for the contribution.

Cheers,


Jeremy

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

* Re: [PATCH] mctp: Fix incorrect tx flow invalidation condition in mctp-i2c
  2025-03-25  8:10 [PATCH] mctp: Fix incorrect tx flow invalidation condition in mctp-i2c Daniel Hsu
  2025-03-25  8:30 ` Jeremy Kerr
@ 2025-03-26 13:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-03-26 13:10 UTC (permalink / raw)
  To: Daniel Hsu
  Cc: jk, matt, andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel, Daniel-Hsu

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Tue, 25 Mar 2025 16:10:08 +0800 you wrote:
> Previously, the condition for invalidating the tx flow in
> mctp_i2c_invalidate_tx_flow() checked if `rc` was nonzero.
> However, this could incorrectly trigger the invalidation
> even when `rc > 0` was returned as a success status.
> 
> This patch updates the condition to explicitly check for `rc < 0`,
> ensuring that only error cases trigger the invalidation.
> 
> [...]

Here is the summary with links:
  - mctp: Fix incorrect tx flow invalidation condition in mctp-i2c
    https://git.kernel.org/netdev/net/c/70facbf978ac

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2025-03-26 13:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-25  8:10 [PATCH] mctp: Fix incorrect tx flow invalidation condition in mctp-i2c Daniel Hsu
2025-03-25  8:30 ` Jeremy Kerr
2025-03-26 13:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).