mirror of
https://github.com/torvalds/linux.git
synced 2026-05-17 19:17:29 +02:00
The zynqmp_pm_set_suspend_mode() and zynqmp_pm_get_trustzone_version()
functions pass values as api_id into zynqmp_pm_invoke_fn
that are beyond PM_API_MAX, resulting in an out-of-bounds access:
drivers/firmware/xilinx/zynqmp.c: In function 'zynqmp_pm_set_suspend_mode':
drivers/firmware/xilinx/zynqmp.c:150:24: warning: array subscript 2562 is above array bounds of 'u32[64]' {aka 'unsigned int[64]'} [-Warray-bounds]
150 | if (zynqmp_pm_features[api_id] != PM_FEATURE_UNCHECKED)
| ~~~~~~~~~~~~~~~~~~^~~~~~~~
drivers/firmware/xilinx/zynqmp.c:28:12: note: while referencing 'zynqmp_pm_features'
28 | static u32 zynqmp_pm_features[PM_API_MAX];
| ^~~~~~~~~~~~~~~~~~
Replace the resulting undefined behavior with an error return.
This may break some things that happen to work at the moment
but seems better than randomly overwriting kernel data.
I assume we need additional fixes for the two functions that now
return an error.
Fixes:
|
||
|---|---|---|
| .. | ||
| arm_scmi | ||
| broadcom | ||
| efi | ||
| imx | ||
| meson | ||
| psci | ||
| smccc | ||
| tegra | ||
| xilinx | ||
| arm_scpi.c | ||
| arm_sdei.c | ||
| dmi_scan.c | ||
| dmi-id.c | ||
| dmi-sysfs.c | ||
| edd.c | ||
| iscsi_ibft_find.c | ||
| iscsi_ibft.c | ||
| Kconfig | ||
| Makefile | ||
| memmap.c | ||
| pcdp.c | ||
| pcdp.h | ||
| qcom_scm-legacy.c | ||
| qcom_scm-smc.c | ||
| qcom_scm.c | ||
| qcom_scm.h | ||
| qemu_fw_cfg.c | ||
| raspberrypi.c | ||
| scpi_pm_domain.c | ||
| stratix10-rsu.c | ||
| stratix10-svc.c | ||
| ti_sci.c | ||
| ti_sci.h | ||
| trusted_foundations.c | ||
| turris-mox-rwtm.c | ||