linux/drivers/devfreq
Christian Marangi a979f56aa4 PM / devfreq: Fix buffer overflow in trans_stat_show
commit 08e23d05fa upstream.

Fix buffer overflow in trans_stat_show().

Convert simple snprintf to the more secure scnprintf with size of
PAGE_SIZE.

Add condition checking if we are exceeding PAGE_SIZE and exit early from
loop. Also add at the end a warning that we exceeded PAGE_SIZE and that
stats is disabled.

Return -EFBIG in the case where we don't have enough space to write the
full transition table.

Also document in the ABI that this function can return -EFBIG error.

Link: https://lore.kernel.org/all/20231024183016.14648-2-ansuelsmth@gmail.com/
Cc: stable@vger.kernel.org
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218041
Fixes: e552bbaf5b ("PM / devfreq: Add sysfs node for representing frequency transition information.")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-01-31 16:18:50 -08:00
..
event PM / devfreq: rockchip-dfi: Make pmu regmap mandatory 2023-11-20 11:59:00 +01:00
devfreq-event.c driver core: class: remove module * from class_create() 2023-03-17 15:16:33 +01:00
devfreq.c PM / devfreq: Fix buffer overflow in trans_stat_show 2024-01-31 16:18:50 -08:00
exynos-bus.c PM / devfreq: exynos: add Exynos PPMU as a soft module dependency 2023-05-29 23:24:13 +09:00
governor_passive.c PM / devfreq: passive: revert an editing accident in SPDX-License line 2022-06-30 05:11:17 +09:00
governor_performance.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
governor_powersave.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
governor_simpleondemand.c PM / devfreq: Add governor attribute flag for specifc sysfs nodes 2020-10-26 11:46:54 +09:00
governor_userspace.c PM/devfreq: governor: Add a private governor_data for governor 2022-11-20 20:49:51 +09:00
governor.h PM / devfreq: passive: Keep cpufreq_policy for possible cpus 2022-05-17 18:24:39 +09:00
imx8m-ddrc.c PM / devfreq: Explicitly include correct DT includes 2023-07-24 05:19:26 +09:00
imx-bus.c PM / devfreq: Explicitly include correct DT includes 2023-07-24 05:19:26 +09:00
Kconfig PM / devfreq: Remove "select SRCU" 2023-03-13 19:36:15 +09:00
Makefile PM / devfreq: mediatek: Introduce MediaTek CCI devfreq driver 2022-07-15 11:40:08 +09:00
mtk-cci-devfreq.c PM / devfreq: Explicitly include correct DT includes 2023-07-24 05:19:26 +09:00
rk3399_dmc.c PM / devfreq: rk3399_dmc: Block PMU during transitions 2022-05-09 03:38:07 +09:00
sun8i-a33-mbus.c PM / devfreq: Add a driver for the sun8i/sun50i MBUS 2021-12-10 15:56:07 +09:00
tegra30-devfreq.c PM / devfreq: Explicitly include correct DT includes 2023-07-24 05:19:26 +09:00