linux/drivers/i2c
Mans Rullgard 40e0520059 i2c: core: check returned size of emulated smbus block read
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: 209d27c3b1 ("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>
2020-06-26 10:18:35 +02:00
..
algos i2c: algo-pca: update contact email 2020-05-15 11:23:49 +02:00
busses i2c: fsi: Fix the port number field in status register 2020-06-26 00:25:05 +02:00
muxes Merge branch 'i2c/for-current-fixed' into i2c/for-5.8 2020-05-20 15:27:45 +02:00
i2c-boardinfo.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
i2c-core-acpi.c i2c: acpi: Drop double check for ACPI companion device 2020-05-28 18:01:20 +02:00
i2c-core-base.c i2c: remove deprecated i2c_new_device API 2020-06-19 09:20:28 +02:00
i2c-core-of.c i2c: use my kernel.org address from now on 2020-05-05 16:29:09 +02:00
i2c-core-slave.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
i2c-core-smbus.c i2c: core: check returned size of emulated smbus block read 2020-06-26 10:18:35 +02:00
i2c-core.h i2c: reword explanation about atomic transfers 2020-05-20 15:25:55 +02:00
i2c-dev.c i2c: dev: Fix the race between the release of i2c_dev and cdev 2020-03-20 18:34:29 +01:00
i2c-mux.c i2c: mux: add sysfs header 2019-06-22 07:32:33 +02:00
i2c-slave-eeprom.c i2c: slave-eeprom: update documentation to recent changes 2020-05-28 18:06:10 +02:00
i2c-smbus.c i2c: smbus: Add a way to instantiate SPD EEPROMs automatically 2020-05-29 12:53:04 +02:00
i2c-stub.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile i2c: don't use any __deprecated handling anymore 2018-08-24 17:26:43 +02:00