mctp: Fix incorrect tx flow invalidation condition in mctp-i2c
PATCH 1/1 mctp: Fix incorrect tx flow invalidation condition in mctp-i2c
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.
--- drivers/net/mctp/mctp-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mctp/mctp-i2c.c +1 -1
@@ -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 ;
Signature · 1 line
2.25.1
Hi Daniel,
Quoted 4 lines
Previously, the condition for invalidating the tx flow in
mctp_i2c_invalidate_tx_flow()checked ifrcwas nonzero. However, this could incorrectly trigger the invalidation even whenrc > 0was returned as a success status.
Yes, and we should be seeing rc > 0 in normal behaviour...
Quoted 2 lines
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:
I figure you'll want to target the net (not net-next) tree, in which case you'll probably need this:
Thanks for the contribution.
Cheers,
Jeremy
This patch was applied to netdev/net.git (main) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:
Quoted 9 lines · 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 ifrcwas nonzero. However, this could incorrectly trigger the invalidation even whenrc > 0was 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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html