Zheyu Ma
9ac541a089
i2c: ismt: Fix an out-of-bounds bug in ismt_access()
...
[ Upstream commit 39244cc754829bf707dccd12e2ce37510f5b1f8d ]
When the driver does not check the data from the user, the variable
'data->block[0]' may be very large to cause an out-of-bounds bug.
The following log can reveal it:
[ 33.995542] i2c i2c-1: ioctl, cmd=0x720, arg=0x7ffcb3dc3a20
[ 33.995978] ismt_smbus 0000:00:05.0: I2C_SMBUS_BLOCK_DATA: WRITE
[ 33.996475] ==================================================================
[ 33.996995] BUG: KASAN: out-of-bounds in ismt_access.cold+0x374/0x214b
[ 33.997473] Read of size 18446744073709551615 at addr ffff88810efcfdb1 by task ismt_poc/485
[ 33.999450] Call Trace:
[ 34.001849] memcpy+0x20/0x60
[ 34.002077] ismt_access.cold+0x374/0x214b
[ 34.003382] __i2c_smbus_xfer+0x44f/0xfb0
[ 34.004007] i2c_smbus_xfer+0x10a/0x390
[ 34.004291] i2cdev_ioctl_smbus+0x2c8/0x710
[ 34.005196] i2cdev_ioctl+0x5ec/0x74c
Fix this bug by checking the size of 'data->block[0]' first.
Fixes: 13f35ac14c
("i2c: Adding support for Intel iSMT SMBus 2.0 host controller")
Signed-off-by: Zheyu Ma <zheyuma97@gmail.com >
Signed-off-by: Wolfram Sang <wsa@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2023-01-14 10:16:00 +01:00
..
2019-06-19 17:09:55 +02:00
2020-07-04 08:25:13 +02:00
2020-07-04 08:25:13 +02:00
2019-06-05 17:37:16 +02:00
2020-05-20 15:28:03 +02:00
2019-05-30 11:26:37 -07:00
2019-05-30 11:26:37 -07:00
2020-07-23 22:04:08 +02:00
2020-04-30 16:11:41 +02:00
2020-09-21 11:45:43 +02:00
2019-03-25 15:21:17 +01:00
2020-09-14 08:55:44 +02:00
2020-05-05 16:37:21 +02:00
2022-06-09 10:21:19 +02:00
2019-03-24 22:41:51 +01:00
2020-08-05 11:52:27 +02:00
2019-05-30 11:26:37 -07:00
2020-04-18 23:42:14 +02:00
2022-03-08 19:09:29 +01:00
2021-03-04 11:37:53 +01:00
2020-04-18 23:42:14 +02:00
2022-02-23 12:01:08 +01:00
2022-08-21 15:15:49 +02:00
2021-12-08 09:03:23 +01:00
2020-04-18 23:42:14 +02:00
2020-09-27 15:14:16 +02:00
2020-01-31 09:01:25 +01:00
2020-04-15 12:09:09 +02:00
2020-03-21 19:53:08 +01:00
2022-06-22 14:13:18 +02:00
2020-06-23 21:24:33 +02:00
2021-04-14 08:42:11 +02:00
2022-01-27 10:54:23 +01:00
2022-06-22 14:13:18 +02:00
2020-11-06 16:02:00 +01:00
2020-07-23 22:04:08 +02:00
2020-03-24 22:36:59 +01:00
2019-06-05 17:37:10 +02:00
2020-09-29 21:37:46 +02:00
2020-08-10 15:47:38 +02:00
2019-05-30 11:26:37 -07:00
2021-05-14 09:50:37 +02:00
2021-03-04 11:38:20 +01:00
2020-07-24 21:31:33 +02:00
2020-03-10 12:31:55 +01:00
2021-09-15 09:50:36 +02:00
2021-09-15 09:50:42 +02:00
2019-05-30 11:26:37 -07:00
2022-11-25 17:45:40 +01:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2020-06-07 20:45:24 +02:00
2021-05-14 09:50:36 +02:00
2021-05-14 09:50:36 +02:00
2022-12-08 11:23:59 +01:00
2021-09-15 09:50:42 +02:00
2019-07-15 21:10:39 -07:00
2019-05-30 11:26:41 -07:00
2023-01-14 10:16:00 +01:00
2021-05-14 09:50:37 +02:00
2019-06-05 17:36:38 +02:00
2020-04-18 23:42:14 +02:00
2022-04-08 14:40:22 +02:00
2022-10-26 13:25:22 +02:00
2020-07-04 08:20:38 +02:00
2022-01-27 10:54:21 +01:00
2021-11-18 14:04:22 +01:00
2022-05-25 09:18:01 +02:00
2020-09-29 21:40:03 +02:00
2020-09-18 23:11:44 +02:00
2019-05-30 11:26:37 -07:00
2019-05-30 11:26:37 -07:00
2022-04-08 14:40:02 +02:00
2022-12-08 11:23:59 +01:00
2020-09-21 12:05:40 +02:00
2020-01-15 20:39:26 +01:00
2021-01-27 11:55:09 +01:00
2018-03-02 11:11:15 +01:00
2020-04-15 12:09:09 +02:00
2021-05-14 09:50:37 +02:00
2020-08-23 17:36:59 -05:00
2020-10-21 10:54:05 -07:00
2020-03-10 12:19:52 +01:00
2022-04-20 09:23:30 +02:00
2019-05-30 11:26:37 -07:00
2020-04-15 12:12:52 +02:00
2022-11-10 18:14:24 +01:00
2020-02-07 12:54:13 -08:00
2020-07-04 08:25:13 +02:00
2020-04-30 16:18:30 +02:00
2023-01-14 10:15:59 +01:00
2020-06-03 22:37:37 +02:00
2022-10-30 09:41:15 +01:00
2021-06-10 13:39:29 +02:00
2020-12-02 16:42:09 +01:00
2022-06-09 10:21:20 +02:00
2020-03-24 22:36:59 +01:00
2021-12-17 10:14:40 +01:00
2021-06-30 08:47:25 -04:00
2021-09-15 09:50:42 +02:00
2019-06-05 17:37:10 +02:00
2021-05-14 09:50:39 +02:00
2021-06-03 09:00:39 +02:00
2020-07-04 08:25:13 +02:00
2019-06-19 17:09:07 +02:00
2020-07-04 08:25:13 +02:00
2019-05-30 11:26:37 -07:00
2019-05-30 11:26:37 -07:00
2019-05-30 11:26:37 -07:00
2021-05-14 09:50:37 +02:00
2020-04-02 15:54:13 -07:00
2020-09-21 11:45:43 +02:00
2019-08-14 14:56:54 +02:00
2020-09-21 11:45:43 +02:00
2021-12-08 09:03:23 +01:00
2020-04-15 12:09:09 +02:00
2020-04-18 23:42:14 +02:00
2021-09-15 09:50:41 +02:00
2020-01-15 20:39:41 +01:00
2021-01-27 11:54:50 +01:00
2022-11-25 17:45:40 +01:00
2022-06-06 08:42:40 +02:00
2020-01-06 15:40:43 +01:00
2020-04-18 23:42:14 +02:00
2020-04-18 23:42:14 +02:00
2019-06-19 17:09:55 +02:00
2019-05-30 11:26:37 -07:00
2020-07-23 22:04:08 +02:00
2019-05-30 11:26:32 -07:00
2020-03-24 22:36:59 +01:00
2019-05-21 11:28:45 +02:00
2022-11-10 18:14:23 +01:00
2021-09-15 09:50:44 +02:00
2021-11-18 14:04:25 +01:00
2020-04-15 12:09:09 +02:00
2022-03-08 19:09:30 +01:00
2020-09-27 19:58:38 +02:00
2020-07-23 22:04:08 +02:00