usbio_i2c_xfer() ignores the return value of usbio_acquire() and always calls usbio_release() on the way out. usbio_acquire() fails once the bridge has been disconnected, and neither the transfer nor the release may be issued in that case. Return the error instead. Fixes: daf161343a39 ("i2c: Add Intel USBIO I2C driver") Cc: stable@vger.kernel.org Co-developed-by: Bin Yu Signed-off-by: Bin Yu Co-developed-by: Cheng Wen Signed-off-by: Cheng Wen Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn> --- Changes in v2: - Drop the mechanism paragraph and the crash log from the commit message, as suggested by Sakari Ailus. --- drivers/i2c/busses/i2c-usbio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-usbio.c b/drivers/i2c/busses/i2c-usbio.c index 259754e5fd05..232397efe8a4 100644 --- a/drivers/i2c/busses/i2c-usbio.c +++ b/drivers/i2c/busses/i2c-usbio.c @@ -178,7 +178,9 @@ static int usbio_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int nu struct usbio_i2c *i2c = i2c_get_adapdata(adap); int ret; - usbio_acquire(i2c->adev); + ret = usbio_acquire(i2c->adev); + if (ret) + return ret; ret = usbio_i2c_init(adap, msgs); if (ret) -- 2.34.1