Skip to content
Snippets Groups Projects
Commit af6bf45e authored by Kai Shen's avatar Kai Shen Committed by Greg Kroah-Hartman
Browse files

cpufreq: Add NULL checks to show() and store() methods of cpufreq


commit e6e8df07 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: default avatarKai Shen <shenkai8@huawei.com>
Reported-by: default avatarFeilong Lin <linfeilong@huawei.com>
Reviewed-by: default avatarFeilong Lin <linfeilong@huawei.com>
Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
[ rjw: Subject & changelog ]
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0ab8d923
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment