https://github.com/torvalds/linux
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
Tip revision: b5d281f6c16dd432b618bdfd36ddba1a58d5b603 authored by Christian Marangi on 19 June 2022, 22:03:51 UTC
PM / devfreq: Rework freq_table to be local to devfreq struct
Tip revision: b5d281f
File Mode Size
partitions
Kconfig -rw-r--r-- 7.0 KB
Kconfig.iosched -rw-r--r-- 1.3 KB
Makefile -rw-r--r-- 1.8 KB
badblocks.c -rw-r--r-- 14.1 KB
bdev.c -rw-r--r-- 27.5 KB
bfq-cgroup.c -rw-r--r-- 39.9 KB
bfq-iosched.c -rw-r--r-- 258.8 KB
bfq-iosched.h -rw-r--r-- 37.6 KB
bfq-wf2q.c -rw-r--r-- 52.4 KB
bio-integrity.c -rw-r--r-- 12.3 KB
bio.c -rw-r--r-- 48.3 KB
blk-cgroup-fc-appid.c -rw-r--r-- 1.4 KB
blk-cgroup-rwstat.c -rw-r--r-- 3.4 KB
blk-cgroup-rwstat.h -rw-r--r-- 3.9 KB
blk-cgroup.c -rw-r--r-- 52.8 KB
blk-cgroup.h -rw-r--r-- 16.4 KB
blk-core.c -rw-r--r-- 34.7 KB
blk-crypto-fallback.c -rw-r--r-- 18.7 KB
blk-crypto-internal.h -rw-r--r-- 5.7 KB
blk-crypto-profile.c -rw-r--r-- 16.4 KB
blk-crypto-sysfs.c -rw-r--r-- 4.4 KB
blk-crypto.c -rw-r--r-- 12.1 KB
blk-flush.c -rw-r--r-- 15.5 KB
blk-ia-ranges.c -rw-r--r-- 9.0 KB
blk-integrity.c -rw-r--r-- 11.9 KB
blk-ioc.c -rw-r--r-- 10.5 KB
blk-iocost.c -rw-r--r-- 96.6 KB
blk-iolatency.c -rw-r--r-- 29.2 KB
blk-ioprio.c -rw-r--r-- 6.5 KB
blk-ioprio.h -rw-r--r-- 332 bytes
blk-lib.c -rw-r--r-- 8.9 KB
blk-map.c -rw-r--r-- 14.5 KB
blk-merge.c -rw-r--r-- 29.7 KB
blk-mq-cpumap.c -rw-r--r-- 2.2 KB
blk-mq-debugfs-zoned.c -rw-r--r-- 435 bytes
blk-mq-debugfs.c -rw-r--r-- 21.6 KB
blk-mq-debugfs.h -rw-r--r-- 2.4 KB
blk-mq-pci.c -rw-r--r-- 1.3 KB
blk-mq-rdma.c -rw-r--r-- 1.3 KB
blk-mq-sched.c -rw-r--r-- 17.7 KB
blk-mq-sched.h -rw-r--r-- 2.5 KB
blk-mq-sysfs.c -rw-r--r-- 7.0 KB
blk-mq-tag.c -rw-r--r-- 18.4 KB
blk-mq-tag.h -rw-r--r-- 2.3 KB
blk-mq-virtio.c -rw-r--r-- 1.3 KB
blk-mq.c -rw-r--r-- 118.3 KB
blk-mq.h -rw-r--r-- 11.1 KB
blk-pm.c -rw-r--r-- 6.6 KB
blk-pm.h -rw-r--r-- 763 bytes
blk-rq-qos.c -rw-r--r-- 7.0 KB
blk-rq-qos.h -rw-r--r-- 5.6 KB
blk-settings.c -rw-r--r-- 30.2 KB
blk-stat.c -rw-r--r-- 5.4 KB
blk-stat.h -rw-r--r-- 4.8 KB
blk-sysfs.c -rw-r--r-- 24.0 KB
blk-throttle.c -rw-r--r-- 64.4 KB
blk-throttle.h -rw-r--r-- 6.0 KB
blk-timeout.c -rw-r--r-- 4.1 KB
blk-wbt.c -rw-r--r-- 19.9 KB
blk-wbt.h -rw-r--r-- 2.7 KB
blk-zoned.c -rw-r--r-- 16.6 KB
blk.h -rw-r--r-- 14.4 KB
bounce.c -rw-r--r-- 6.5 KB
bsg-lib.c -rw-r--r-- 9.8 KB
bsg.c -rw-r--r-- 6.1 KB
disk-events.c -rw-r--r-- 12.9 KB
elevator.c -rw-r--r-- 19.2 KB
elevator.h -rw-r--r-- 5.2 KB
fops.c -rw-r--r-- 16.5 KB
genhd.c -rw-r--r-- 36.9 KB
holder.c -rw-r--r-- 4.1 KB
ioctl.c -rw-r--r-- 16.4 KB
ioprio.c -rw-r--r-- 4.8 KB
kyber-iosched.c -rw-r--r-- 27.9 KB
mq-deadline.c -rw-r--r-- 31.8 KB
opal_proto.h -rw-r--r-- 9.4 KB
sed-opal.c -rw-r--r-- 62.5 KB
t10-pi.c -rw-r--r-- 12.5 KB

back to top