linux-stable/drivers/cpufreq
Kai Shen af6bf45e59 cpufreq: Add NULL checks to show() and store() methods of cpufreq
commit e6e8df0726 upstream.

Add NULL checks to show() and store() in cpufreq.c to avoid attempts
to invoke a NULL callback.

Though some interfaces of cpufreq are set as read-only, users can
still get write permission using chmod which can lead to a kernel
crash, as follows:

chmod +w /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
echo 1 >  /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq

This bug was found in linux 4.19.

Signed-off-by: Kai Shen <shenkai8@huawei.com>
Reported-by: Feilong Lin <linfeilong@huawei.com>
Reviewed-by: Feilong Lin <linfeilong@huawei.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
[ rjw: Subject & changelog ]
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-01 09:14:25 +01:00
..
acpi-cpufreq.c cpufreq: acpi-cpufreq: Report if CPU doesn't support boost technologies 2019-04-05 22:31:31 +02:00
amd_freq_sensitivity.c cpufreq: Reuse new freq-table helpers 2016-07-07 00:14:27 +02:00
arm_big_little.c cpufreq: arm_big_little: Make ->get_transition_latency() mandatory 2017-07-26 00:15:44 +02:00
arm_big_little.h
arm_big_little_dt.c
at32ap-cpufreq.c
blackfin-cpufreq.c
bmips-cpufreq.c cpufreq: bmips-cpufreq: CPUfreq driver for Broadcom's BMIPS SoCs 2017-02-09 01:22:44 +01:00
brcmstb-avs-cpufreq.c cpufreq: brcmstb-avs-cpufreq: remove unnecessary platform_set_drvdata() 2017-02-09 01:22:46 +01:00
cppc_cpufreq.c cpufreq / CPPC: Set platform specific transition_delay_us 2018-07-22 14:28:42 +02:00
cpufreq-dt-platdev.c cpufreq: mediatek: add mediatek related projects into blacklist 2018-02-16 20:22:43 +01:00
cpufreq-dt.c cpufreq: dt: Try freeing static OPPs only if we have added them 2018-11-13 11:14:54 -08:00
cpufreq-dt.h cpufreq: dt: Support governor tunables per policy 2016-09-13 02:39:12 +02:00
cpufreq-nforce2.c cpufreq: Add CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING cpufreq driver flag 2017-07-26 00:15:46 +02:00
cpufreq.c cpufreq: Add NULL checks to show() and store() methods of cpufreq 2019-12-01 09:14:25 +01:00
cpufreq_conservative.c cpufreq: conservative: Take limits changes into account properly 2018-11-13 11:14:45 -08:00
cpufreq_governor.c sched/cpufreq: Fix kobject memleak 2019-05-31 06:47:19 -07:00
cpufreq_governor.h cpufreq: Replace "max_transition_latency" with "dynamic_switching" 2017-07-26 00:15:45 +02:00
cpufreq_governor_attr_set.c
cpufreq_ondemand.c cpufreq: governor: Drop min_sampling_rate 2017-07-22 02:25:20 +02:00
cpufreq_ondemand.h
cpufreq_performance.c
cpufreq_powersave.c
cpufreq_stats.c Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux 2017-07-14 13:12:32 -07:00
cpufreq_userspace.c
cris-artpec3-cpufreq.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cris-etraxfs-cpufreq.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
davinci-cpufreq.c ARM: davinci: da850: fix da850_set_pll0rate() 2017-01-02 15:02:51 +05:30
e_powersaver.c
elanfreq.c cpufreq: Add CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING cpufreq driver flag 2017-07-26 00:15:46 +02:00
exynos5440-cpufreq.c cpufreq: exynos5440: Fix inconsistent indenting 2017-06-24 01:38:00 +02:00
freq_table.c cpufreq: Handle sorted frequency tables more efficiently 2016-07-07 00:13:20 +02:00
gx-suspmod.c cpufreq: Add CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING cpufreq driver flag 2017-07-26 00:15:46 +02:00
highbank-cpufreq.c
ia64-acpi-cpufreq.c cpufreq/ia64: Replace racy task affinity logic 2017-04-15 12:20:55 +02:00
imx6q-cpufreq.c cpufreq: imx6q: add return value check for voltage scale 2018-12-01 09:42:53 +01:00
intel_pstate.c x86/cpu: Sanitize FAM6_ATOM naming 2019-05-14 19:18:42 +02:00
Kconfig cpufreq: Add Loongson machine dependencies 2018-02-03 17:39:00 +01:00
Kconfig.arm cpufreq: dbx500: Delete obsolete driver 2017-08-22 15:50:02 +02:00
Kconfig.powerpc
Kconfig.x86 sched/x86: Change CONFIG_SCHED_ITMT to CONFIG_SCHED_MC_PRIO 2016-11-30 08:27:08 +01:00
kirkwood-cpufreq.c cpufreq: kirkwood: fix possible object reference leak 2019-05-31 06:47:29 -07:00
longhaul.c cpufreq: longhaul: Revert transition_delay_us to 200 ms 2018-03-24 11:01:21 +01:00
longhaul.h
longrun.c cpufreq: Don't set transition_latency for setpolicy drivers 2017-07-26 00:15:43 +02:00
loongson1-cpufreq.c
loongson2_cpufreq.c cpufreq: Loongson2: constify platform_device_id 2017-08-18 01:44:21 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
maple-cpufreq.c
mediatek-cpufreq.c cpufreq: mediatek: add support of cpufreq to MT7622 SoC 2017-08-10 01:29:53 +02:00
mvebu-cpufreq.c cpufreq: mvebu: fix integer to pointer cast 2016-06-13 23:49:43 +02:00
omap-cpufreq.c PM / OPP: Update OPP users to put reference 2017-01-30 09:22:21 +01:00
p4-clockmod.c x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping 2018-02-22 15:42:24 +01:00
pasemi-cpufreq.c cpufreq/pasemi: fix use-after-free in pas_cpufreq_cpu_init() 2019-08-16 10:13:52 +02:00
pcc-cpufreq.c cpufreq: intel_pstate: Register when ACPI PCCH is present 2018-07-25 11:25:08 +02:00
pmac32-cpufreq.c cpufreq: pmac32: fix possible object reference leak 2019-05-31 06:47:29 -07:00
pmac64-cpufreq.c cpufreq: Convert to using %pOF instead of full_name 2017-08-25 01:20:46 +02:00
powernow-k6.c
powernow-k7.c x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping 2018-02-22 15:42:24 +01:00
powernow-k7.h
powernow-k8.c format-security: move static strings to const 2017-05-08 17:15:14 -07:00
powernow-k8.h
powernv-cpufreq.c cpufreq: powernv: Fix hardlockup due to synchronous smp_call in timer interrupt 2018-05-01 12:58:24 -07:00
ppc_cbe_cpufreq.c cpufreq: ppc_cbe: fix possible object reference leak 2019-05-31 06:47:28 -07:00
ppc_cbe_cpufreq.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ppc_cbe_cpufreq_pervasive.c
ppc_cbe_cpufreq_pmi.c cpufreq: Remove CPUFREQ_START notifier event 2017-02-04 00:05:30 +01:00
pxa2xx-cpufreq.c cpufreq: pxa2xx: remove incorrect __init annotation 2019-03-23 14:35:22 +01:00
pxa3xx-cpufreq.c
qoriq-cpufreq.c thermal: cpu_cooling: use cpufreq_policy to register cooling device 2017-05-27 17:32:24 -07:00
s3c24xx-cpufreq-debugfs.c
s3c24xx-cpufreq.c cpufreq: s3c24xx: Fix broken s3c_cpufreq_init() 2018-03-08 22:41:06 -08:00
s3c64xx-cpufreq.c cpufreq: s3c64xx: remove incorrect __init annotation 2016-12-21 02:54:18 +01:00
s3c2410-cpufreq.c
s3c2412-cpufreq.c
s3c2416-cpufreq.c cpufreq: s3c2416: double free on driver init error path 2017-02-09 01:22:45 +01:00
s3c2440-cpufreq.c
s5pv210-cpufreq.c cpufreq: s5pv210: add missing of_node_put() 2017-07-26 22:54:01 +02:00
sa1100-cpufreq.c cpufreq: Add CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING cpufreq driver flag 2017-07-26 00:15:46 +02:00
sa1110-cpufreq.c cpufreq: Add CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING cpufreq driver flag 2017-07-26 00:15:46 +02:00
sc520_freq.c
scpi-cpufreq.c cpufreq: scpi: use new scpi_ops functions to remove duplicate code 2017-06-05 11:14:35 +01:00
sfi-cpufreq.c cpufreq: sfi: make freq_table static 2017-06-24 01:43:21 +02:00
sh-cpufreq.c cpufreq: Add CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING cpufreq driver flag 2017-07-26 00:15:46 +02:00
sparc-us2e-cpufreq.c cpufreq/sparc-us2e: Replace racy task affinity logic 2017-04-15 12:20:56 +02:00
sparc-us3-cpufreq.c cpufreq/sparc-us3: Replace racy task affinity logic 2017-04-15 12:20:55 +02:00
spear-cpufreq.c
speedstep-centrino.c x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping 2018-02-22 15:42:24 +01:00
speedstep-ich.c cpufreq: speedstep: remove unnecessary static in speedstep_detect_chipset() 2017-07-16 02:12:35 +02:00
speedstep-lib.c x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping 2018-02-22 15:42:24 +01:00
speedstep-lib.h
speedstep-smi.c cpufreq: Add CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING cpufreq driver flag 2017-07-26 00:15:46 +02:00
sti-cpufreq.c cpufreq: Convert to using %pOF instead of full_name 2017-08-25 01:20:46 +02:00
tango-cpufreq.c cpufreq: dt: Don't use generic platdev driver for tango 2017-07-22 02:20:59 +02:00
tegra20-cpufreq.c
tegra124-cpufreq.c cpufreq: tegra124: add missing of_node_put() 2019-03-23 14:35:22 +01:00
tegra186-cpufreq.c cpufreq: Add Tegra186 cpufreq driver 2017-04-19 23:23:08 +02:00
ti-cpufreq.c cpufreq: ti-cpufreq: add missing of_node_put() 2019-11-12 19:18:28 +01:00
unicore2-cpufreq.c cpufreq: Add CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING cpufreq driver flag 2017-07-26 00:15:46 +02:00
vexpress-spc-cpufreq.c