Skip to content

i2c: ismt: Fix length handling for SMBus block reads

Stephen Douthit linux-i2c lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2i2c: ismt: Don't duplicate the receive length for block readsdrivers/i2c/busses/i2c-ismt.c+2 -20 replies
2/2i2c: ismt: Return EMSGSIZE for block reads with bogus lengthdrivers/i2c/busses/i2c-ismt.c+3 -10 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchDan PriamoNeil Horman
SeriesA-b
1/2T-b
2/2T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] i2c: ismt: Fix length handling for SMBus block reads

Hello all,

We ran into an issue where the ipmi_ssif and i2c-ismt drivers don't agree on the format for data returned by i2c_smbus_read_block_data()

Looking at the traffic on the wire with a beagle analyzer:
-----
Packet Details (Values in hex; [S] = Start condition;
[P] = Stop condition; * = No Ack)
[S] <10:R> 12 1C 01 00 00 80 02 1C 02 8F BE 12 00 25 12 41 01 00 00* [P]
-----

Looking at the matching kernel trace:
-----

kssif0010-759   [001] ....  1435.891090: smbus_read: i2c-0 a=010 f=0000 c=3 BLOCK_DATA
kssif0010-759   [001] ....  1436.202906: smbus_reply: i2c-0 a=010 f=0000 c=3 BLOCK_DATA l=20 [13-12-1c-01-00-00-80-02-1c-02-8f-be-12-00-25-12-41-01-00-00]
kssif0010-759   [001] ....  1436.202908: smbus_result: i2c-0 a=010 f=0000 c=3 BLOCK_DATA rd res=0

-----

So basically the byte count already precedes the data in the dma_buffer, then the driver sticks desc->rxbytes in front of this resulting in the trace above.

The first patch tackles this.

The second patch in the series adds a sanity check on the byte count supplied by the slave device. This might be a nice to have, but is probably less critical.

-Steve