Revision 40e05200593af06633f64ab0effff052eee6f076 authored by Mans Rullgard on 13 June 2020, 10:41:09 UTC, committed by Wolfram Sang on 26 June 2020, 08:18:35 UTC
If the i2c bus driver ignores the I2C_M_RECV_LEN flag (as some of
them do), it is possible for an I2C_SMBUS_BLOCK_DATA read issued
on some random device to return an arbitrary value in the first
byte (and nothing else).  When this happens, i2c_smbus_xfer_emulated()
will happily write past the end of the supplied data buffer, thus
causing Bad Things to happen.  To prevent this, check the size
before copying the data block and return an error if it is too large.

Fixes: 209d27c3b167 ("i2c: Emulate SMBus block read over I2C")
Signed-off-by: Mans Rullgard <mans@mansr.com>
[wsa: use better errno]
Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent 502035e
History
File Mode Size
ac97
ali5451
asihpi
au88x0
aw2
ca0106
cs46xx
cs5535audio
ctxfi
echoaudio
emu10k1
hda
ice1712
korg1212
lola
lx6464es
mixart
nm256
oxygen
pcxhr
riptide
rme9652
trident
vx222
ymfpci
Kconfig -rw-r--r-- 25.4 KB
Makefile -rw-r--r-- 2.2 KB
ad1889.c -rw-r--r-- 24.7 KB
ad1889.h -rw-r--r-- 7.9 KB
ak4531_codec.c -rw-r--r-- 16.3 KB
als300.c -rw-r--r-- 20.6 KB
als4000.c -rw-r--r-- 29.6 KB
atiixp.c -rw-r--r-- 44.0 KB
atiixp_modem.c -rw-r--r-- 34.2 KB
azt3328.c -rw-r--r-- 80.9 KB
azt3328.h -rw-r--r-- 15.5 KB
bt87x.c -rw-r--r-- 28.5 KB
cmipci.c -rw-r--r-- 99.9 KB
cs4281.c -rw-r--r-- 62.5 KB
cs5530.c -rw-r--r-- 6.6 KB
ens1370.c -rw-r--r-- 76.9 KB
ens1371.c -rw-r--r-- 38 bytes
es1938.c -rw-r--r-- 54.0 KB
es1968.c -rw-r--r-- 77.8 KB
fm801.c -rw-r--r-- 40.5 KB
intel8x0.c -rw-r--r-- 88.8 KB
intel8x0m.c -rw-r--r-- 35.8 KB
maestro3.c -rw-r--r-- 80.9 KB
rme32.c -rw-r--r-- 56.0 KB
rme96.c -rw-r--r-- 70.0 KB
sis7019.c -rw-r--r-- 38.5 KB
sis7019.h -rw-r--r-- 12.7 KB
sonicvibes.c -rw-r--r-- 49.7 KB
via82xx.c -rw-r--r-- 75.6 KB
via82xx_modem.c -rw-r--r-- 32.9 KB

back to top