Skip to content

Commit af80e6f

Browse files
oohalgregkh
authored andcommitted
cpufreq: powernv: Fix use-after-free
commit d0a72ef upstream. The cpufreq driver has a use-after-free that we can hit if: a) There's an OCC message pending when the notifier is registered, and b) The cpufreq driver fails to register with the core. When a) occurs the notifier schedules a workqueue item to handle the message. The backing work_struct is located on chips[].throttle and when b) happens we clean up by freeing the array. Once we get to the (now free) queued item and the kernel crashes. Fixes: c5e29ea ("cpufreq: powernv: Fix bugs in powernv_cpufreq_{init/exit}") Cc: [email protected] # v4.6+ Signed-off-by: Oliver O'Halloran <[email protected]> Reviewed-by: Gautham R. Shenoy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 9cc4f52 commit af80e6f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/cpufreq/powernv-cpufreq.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,12 @@ static int init_chip_info(void)
10801080

10811081
static inline void clean_chip_info(void)
10821082
{
1083+
int i;
1084+
1085+
/* flush any pending work items */
1086+
if (chips)
1087+
for (i = 0; i < nr_chips; i++)
1088+
cancel_work_sync(&chips[i].throttle);
10831089
kfree(chips);
10841090
}
10851091

0 commit comments

Comments
 (0)