]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
hwmon: occ: validate poll response sensor blocks
authorPengpeng Hou <pengpeng@iscas.ac.cn>
Mon, 20 Jul 2026 11:58:26 +0000 (19:58 +0800)
committerGuenter Roeck <linux@roeck-us.net>
Mon, 20 Jul 2026 14:29:44 +0000 (07:29 -0700)
commit70e76e700fc6c46afb4e17aec099a1ea089b4a22
treed67c8e8d590f8a93163328e375b3308aab2c5efb
parent9813c1f49efeadbcb17e4a41972350ac783f9cac
hwmon: occ: validate poll response sensor blocks

The OCC poll response parser walks a counted list of sensor data blocks.
It used the static backing-array capacity as the parse boundary, but a
transport response makes only data_length bytes current and valid. A
truncated response can therefore make the parser consume a block header or
block extent outside the current response.

Use data_length as the parent boundary, prove the fixed poll header and
each current block header before reading them, and prove the complete block
before advancing. Keep parsed sensor metadata local until the complete
response has passed validation, then publish it. Propagate
malformed-response errors before publishing the OCC as active.

Fixes: aa195fe49b03 ("hwmon (occ): Parse OCC poll response")
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20260720115826.14813-1-pengpeng@iscas.ac.cn
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/occ/common.c