]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
i2c: qup: jump out of the loop in case of timeout
authorYang Xiwen <forbidden405@outlook.com>
Sun, 15 Jun 2025 16:01:10 +0000 (00:01 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Aug 2025 08:48:42 +0000 (09:48 +0100)
commit42c4471b30fa203249f476dd42321cd7efb7f6a8
tree9dfcaa82143fd84a14ed276afb752bf0f2449b44
parent9ea8a9ebbea8276e74b49bcaf06a83e449d97c35
i2c: qup: jump out of the loop in case of timeout

commit a7982a14b3012527a9583d12525cd0dc9f8d8934 upstream.

Original logic only sets the return value but doesn't jump out of the
loop if the bus is kept active by a client. This is not expected. A
malicious or buggy i2c client can hang the kernel in this case and
should be avoided. This is observed during a long time test with a
PCA953x GPIO extender.

Fix it by changing the logic to not only sets the return value, but also
jumps out of the loop and return to the caller with -ETIMEDOUT.

Fixes: fbfab1ab0658 ("i2c: qup: reorganization of driver code to remove polling for qup v1")
Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
Cc: <stable@vger.kernel.org> # v4.17+
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20250616-qca-i2c-v1-1-2a8d37ee0a30@outlook.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/i2c/busses/i2c-qup.c