diff options
| author | Michael Bunk <micha@freedict.org> | 2022-01-16 14:22:36 +0300 |
|---|---|---|
| committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2024-04-29 11:21:50 +0300 |
| commit | 0e148a522b8453115038193e19ec7bea71403e4a (patch) | |
| tree | dd77a45eb230c68a2b00461bc6cb06b64698aef8 /tools/perf/scripts/python/sctop.py | |
| parent | c6ad2b9218d6d9538f60040ad12621ecb1274a0f (diff) | |
| download | linux-0e148a522b8453115038193e19ec7bea71403e4a.tar.xz | |
media: dw2102: Don't translate i2c read into write
The code ignored the I2C_M_RD flag on I2C messages. Instead it assumed
an i2c transaction with a single message must be a write operation and a
transaction with two messages would be a read operation.
Though this works for the driver code, it leads to problems once the i2c
device is exposed to code not knowing this convention. For example,
I did "insmod i2c-dev" and issued read requests from userspace, which
were translated into write requests and destroyed the EEPROM of my
device.
So, just check and respect the I2C_M_READ flag, which indicates a read
when set on a message. If it is absent, it is a write message.
Incidentally, changing from the case statement to a while loop allows
the code to lift the limitation to two i2c messages per transaction.
There are 4 more *_i2c_transfer functions affected by the same behaviour
and limitation that should be fixed in the same way.
Link: https://lore.kernel.org/linux-media/20220116112238.74171-2-micha@freedict.org
Signed-off-by: Michael Bunk <micha@freedict.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/sctop.py')
0 files changed, 0 insertions, 0 deletions
