diff mbox series

mctp: Fix incorrect tx flow invalidation condition in mctp-i2c

Message ID 20250325081008.3372960-1-Daniel-Hsu@quantatw.com (mailing list archive)
State Accepted
Commit 70facbf978ac90c6da17a3de2a8dd111b06f1bac
Delegated to: Netdev Maintainers
Headers show
Series mctp: Fix incorrect tx flow invalidation condition in mctp-i2c | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch warning WARNING: From:/Signed-off-by: email address mismatch: 'From: Daniel Hsu <d486250@gmail.com>' != 'Signed-off-by: Daniel Hsu <Daniel-Hsu@quantatw.com>'
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2025-03-26--00-00 (tests: 896)

Commit Message

Daniel Hsu March 25, 2025, 8:10 a.m. UTC
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(-)

Comments

Jeremy Kerr March 25, 2025, 8:30 a.m. UTC | #1
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
patchwork-bot+netdevbpf@kernel.org March 26, 2025, 1:10 p.m. UTC | #2
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!
diff mbox series

Patch

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;