summaryrefslogtreecommitdiffstats
path: root/lib/ashrdi3.c
diff options
context:
space:
mode:
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>2023-05-03 16:38:50 -0700
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-05-04 20:30:18 +0200
commitb5d68f84f4c62c78bc3d004911d80da5aa22df8b (patch)
treef170a4b0c7125b071620da067ac9f0a8a98a6950 /lib/ashrdi3.c
parent667de5c68440732373f571f7eac4ff44b1b93ee7 (diff)
downloadlinux-stable-b5d68f84f4c62c78bc3d004911d80da5aa22df8b.tar.gz
linux-stable-b5d68f84f4c62c78bc3d004911d80da5aa22df8b.tar.bz2
linux-stable-b5d68f84f4c62c78bc3d004911d80da5aa22df8b.zip
thermal: intel: powerclamp: Fix NULL pointer access issue
If cur_state for the powerclamp cooling device is set to the default minimum state of 0, without setting first to cur_state > 0, this results in NULL pointer access. This NULL pointer access happens in the powercap core idle-inject function idle_inject_set_duration() as there is no NULL check for idle_inject_device pointer. This pointer must be allocated by calling idle_inject_register() or idle_inject_register_full(). In the function powerclamp_set_cur_state(), idle_inject_device pointer is allocated only when the cur_state > 0. But setting 0 without changing to any other state, idle_inject_set_duration() will be called with a NULL idle_inject_device pointer. To address this, just return from powerclamp_set_cur_state() if the current cooling device state is the same as the last one. Since the power-up default cooling device state is 0, changing the state to 0 again here will return without calling idle_inject_set_duration(). Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Fixes: 8526eb7fc75a ("thermal: intel: powerclamp: Use powercap idle-inject feature") Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=217386 Tested-by: Risto A. Paju <teknohog@iki.fi> Cc: 6.3+ <stable@kernel.org> # 6.3+ Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'lib/ashrdi3.c')
0 files changed, 0 insertions, 0 deletions