]> git.baikalelectronics.ru Git - kernel.git/commit
mctp i2c: don't count unused / invalid keys for flow release
authorJeremy Kerr <jk@codeconstruct.com.au>
Thu, 10 Nov 2022 05:31:35 +0000 (13:31 +0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 12 Nov 2022 04:13:27 +0000 (20:13 -0800)
commit36a0b2cb073c66fd30a51ab96e5e427f05a21ea1
treea64ba8233b1da9810f56c3ff7bc477d118a3ae5a
parentcbf6ec0440645f83edba32f028327ca43e8558bd
mctp i2c: don't count unused / invalid keys for flow release

We're currently hitting the WARN_ON in mctp_i2c_flow_release:

    if (midev->release_count > midev->i2c_lock_count) {
        WARN_ONCE(1, "release count overflow");

This may be hit if we expire a flow before sending the first packet it
contains - as we will not be pairing the increment of release_count
(performed on flow release) with the i2c lock operation (only
performed on actual TX).

To fix this, only release a flow if we've encountered it previously (ie,
dev_flow_state does not indicate NEW), as we will mark the flow as
ACTIVE at the same time as accounting for the i2c lock operation. We
also need to add an INVALID flow state, to indicate when we've done the
release.

Fixes: 53abdc527fe3 ("mctp i2c: MCTP I2C binding driver")
Reported-by: Jian Zhang <zhangjian.3032@bytedance.com>
Tested-by: Jian Zhang <zhangjian.3032@bytedance.com>
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Link: https://lore.kernel.org/r/20221110053135.329071-1-jk@codeconstruct.com.au
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/mctp/mctp-i2c.c