mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
sched/cpuacct: Check for NULL when using task_pt_regs()
task_pt_regs() can return NULL for kernel threads, so add a check. This fixes an oops at boot on ppc64. Reported-and-Tested-by: Srikar Dronamraju <[email protected]> Tested-by: Zhao Lei <[email protected]> Signed-off-by: Anton Blanchard <[email protected]> Acked-by: Zhao Lei <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephen Rothwell <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: http://lkml.kernel.org/r/20160406215950.04bc3f0b@kryten Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
parent
2c923e94cd
commit
bd92883051
1 changed files with 3 additions and 4 deletions
|
|
@ -316,12 +316,11 @@ static struct cftype files[] = {
|
|||
void cpuacct_charge(struct task_struct *tsk, u64 cputime)
|
||||
{
|
||||
struct cpuacct *ca;
|
||||
int index;
|
||||
int index = CPUACCT_USAGE_SYSTEM;
|
||||
struct pt_regs *regs = task_pt_regs(tsk);
|
||||
|
||||
if (user_mode(task_pt_regs(tsk)))
|
||||
if (regs && user_mode(regs))
|
||||
index = CPUACCT_USAGE_USER;
|
||||
else
|
||||
index = CPUACCT_USAGE_SYSTEM;
|
||||
|
||||
rcu_read_lock();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue