mbox series

[v2,0/2] i2c: designware: Handle invalid SMBus block data response length value

Message ID 20230726080001.337353-1-tamnguyenchi@os.amperecomputing.com
Headers show
Series i2c: designware: Handle invalid SMBus block data response length value | expand

Message

Tam Nguyen July 26, 2023, 7:59 a.m. UTC
This v2 patch series updates the I2C DesignWare driver to handle invalid
SMBus block data response length value that causes the bus is hang and
can not be recovered.

v2:
  + Create new commit to correct length byte validation logic    [Quan]
  + Get right data length from IC_DATA_CMD register              [Jarkko]

Quan Nguyen (1):
  i2c: designware: Correct length byte validation logic

Tam Nguyen (1):
  i2c: designware: Handle invalid SMBus block data response length value

 drivers/i2c/busses/i2c-designware-master.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

Comments

Jarkko Nikula July 27, 2023, 10:36 a.m. UTC | #1
On 7/26/23 11:00, Tam Nguyen wrote:
> From: Quan Nguyen <quan@os.amperecomputing.com>
> 
> Commit 0daede80f870 ("i2c: designware: Convert driver to using regmap API")
> changes the logic to validate the whole 32-bit return value of
> DW_IC_DATA_CMD register instead of 8-bit LSB without reason.
> 
> Later, commit f53f15ba5a85 ("i2c: designware: Get right data length"),
> introduced partial fix but not enough because the "tmp > 0" still test
> tmp as 32-bit value and is wrong in case the IC_DATA_CMD[11] is set.
> 
> Revert the logic to just before commit 0daede80f870
> ("i2c: designware: Convert driver to using regmap API").
> 
> Fixes: f53f15ba5a85 ("i2c: designware: Get right data length")
> Fixes: 0daede80f870 ("i2c: designware: Convert driver to using regmap API")
> Cc: stable@vger.kernel.org
> Signed-off-by: Tam Nguyen <tamnguyenchi@os.amperecomputing.com>
> Signed-off-by: Quan Nguyen <quan@os.amperecomputing.com>
> ---
>   drivers/i2c/busses/i2c-designware-master.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Andi Shyti Aug. 2, 2023, 8:02 p.m. UTC | #2
Hi

On Wed, 26 Jul 2023 14:59:59 +0700, Tam Nguyen wrote:
> This v2 patch series updates the I2C DesignWare driver to handle invalid
> SMBus block data response length value that causes the bus is hang and
> can not be recovered.
> 
> v2:
>   + Create new commit to correct length byte validation logic    [Quan]
>   + Get right data length from IC_DATA_CMD register              [Jarkko]
> 
> [...]

Applied to i2c/andi-for-current on

https://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git

Please note that this patch may still undergo further evaluation
and the final decision will be made in collaboration with
Wolfram.

Thank you,
Andi

Patches applied
===============
[1/2] i2c: designware: Correct length byte validation logic
      commit: 29a1ae0bd13f45da520a7106abfe347f9375f64e
[2/2] i2c: designware: Handle invalid SMBus block data response length value
      commit: dcd14feb235bed87a9cba63538bcf6a7a7e97b78