]> www.infradead.org Git - users/hch/misc.git/commitdiff
mctp: Fix incorrect tx flow invalidation condition in mctp-i2c
authorDaniel Hsu <d486250@gmail.com>
Tue, 25 Mar 2025 08:10:08 +0000 (16:10 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 26 Mar 2025 13:03:59 +0000 (13:03 +0000)
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>
Reviewed-by: Jeremy Kerr <jk@codeconstruct.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/mctp/mctp-i2c.c

index d74d47dd6e04dcf4163bb8cdc446dc3c649880d2..f782d93f826efcbde86137822895ab67c3b721c0 100644 (file)
@@ -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;