Revision b5d281f6c16dd432b618bdfd36ddba1a58d5b603 authored by Christian Marangi on 19 June 2022, 22:03:51 UTC, committed by Chanwoo Choi on 29 June 2022, 20:11:17 UTC
On a devfreq PROBE_DEFER, the freq_table in the driver profile struct,
is never reset and may be leaved in an undefined state.

This comes from the fact that we store the freq_table in the driver
profile struct that is commonly defined as static and not reset on
PROBE_DEFER.
We currently skip the reinit of the freq_table if we found
it's already defined since a driver may declare his own freq_table.

This logic is flawed in the case devfreq core generate a freq_table, set
it in the profile struct and then PROBE_DEFER, freeing the freq_table.
In this case devfreq will found a NOT NULL freq_table that has been
freed, skip the freq_table generation and probe the driver based on the
wrong table.

To fix this and correctly handle PROBE_DEFER, use a local freq_table and
max_state in the devfreq struct and never modify the freq_table present
in the profile struct if it does provide it.

Fixes: 0ec09ac2cebe ("PM / devfreq: Set the freq_table of devfreq device")
Cc: stable@vger.kernel.org
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
1 parent f44b799
History
File Mode Size
read_overflow-memchr.c -rw-r--r-- 123 bytes
read_overflow-memchr_inv.c -rw-r--r-- 127 bytes
read_overflow-memcmp.c -rw-r--r-- 124 bytes
read_overflow-memscan.c -rw-r--r-- 124 bytes
read_overflow2-memcmp.c -rw-r--r-- 124 bytes
read_overflow2-memcpy.c -rw-r--r-- 127 bytes
read_overflow2-memmove.c -rw-r--r-- 128 bytes
read_overflow2_field-memcpy.c -rw-r--r-- 138 bytes
read_overflow2_field-memmove.c -rw-r--r-- 139 bytes
test_fortify.h -rw-r--r-- 775 bytes
write_overflow-memcpy.c -rw-r--r-- 135 bytes
write_overflow-memmove.c -rw-r--r-- 136 bytes
write_overflow-memset.c -rw-r--r-- 130 bytes
write_overflow-strcpy-lit.c -rw-r--r-- 113 bytes
write_overflow-strcpy.c -rw-r--r-- 109 bytes
write_overflow-strlcpy-src.c -rw-r--r-- 129 bytes
write_overflow-strlcpy.c -rw-r--r-- 143 bytes
write_overflow-strncpy-src.c -rw-r--r-- 129 bytes
write_overflow-strncpy.c -rw-r--r-- 143 bytes
write_overflow-strscpy.c -rw-r--r-- 143 bytes
write_overflow_field-memcpy.c -rw-r--r-- 138 bytes
write_overflow_field-memmove.c -rw-r--r-- 139 bytes
write_overflow_field-memset.c -rw-r--r-- 137 bytes

back to top