linux/drivers/platform/arm64
Linmao Li 1b04f556e8
platform: arm64: qcom-hamoa-ec: reject incomplete responses
qcom_ec_read() accepts short positive transfers, while both callers
unconditionally consume every field in their fixed-size response. A short
transfer can therefore make them use trailing stack bytes that were not
returned by the device.

The first response byte contains the number of payload bytes, excluding
the byte count itself. A complete response of resp_len bytes must
therefore report resp_len - 1 payload bytes. The existing check only
rejects counts that do not fit in the response buffer and still accepts
an incomplete payload.

Require both the SMBus transfer length and the EC-provided payload count
to match the expected response size.

Fixes: 5c44f48e91 ("platform: arm64: Add driver for EC found on Qualcomm reference devices")
Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Anvesh Jain P <anvesh.p@oss.qualcomm.com>
Link: https://patch.msgid.link/20260728111924.4106898-1-lilinmao@kylinos.cn
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2026-08-03 20:02:53 +03:00
..
acer-aspire1-ec.c platform: arm64 Use named initializers for struct i2c_device_id 2026-05-28 14:43:39 +03:00
huawei-gaokun-ec.c platform: arm64 Use named initializers for struct i2c_device_id 2026-05-28 14:43:39 +03:00
Kconfig platform: arm64: Add driver for EC found on Qualcomm reference devices 2026-05-11 16:46:36 +03:00
lenovo-thinkpad-t14s.c platform: arm64 Use named initializers for struct i2c_device_id 2026-05-28 14:43:39 +03:00
lenovo-yoga-c630.c platform: arm64 Use named initializers for struct i2c_device_id 2026-05-28 14:43:39 +03:00
Makefile platform: arm64: Add driver for EC found on Qualcomm reference devices 2026-05-11 16:46:36 +03:00
qcom-hamoa-ec.c platform: arm64: qcom-hamoa-ec: reject incomplete responses 2026-08-03 20:02:53 +03:00