Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1377855
| From | tip-bot for Anton Blanchard <tipbot@zytor.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [tip:sched/core] sched/cpuacct: Check for NULL when using task_pt_regs() |
| Date | 2016-04-13 14:00 +0200 |
| Message-ID | <rnrCG-Gd-29@gated-at.bofh.it> (permalink) |
| References | <rkUrw-3zX-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Commit-ID: bd92883051a0228cc34996b8e766111ba10c9aac
Gitweb: http://git.kernel.org/tip/bd92883051a0228cc34996b8e766111ba10c9aac
Author: Anton Blanchard <anton@samba.org>
AuthorDate: Wed, 6 Apr 2016 21:59:50 +1000
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 13 Apr 2016 13:22:37 +0200
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 <srikar@linux.vnet.ibm.com>
Tested-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: Anton Blanchard <anton@samba.org>
Acked-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: efault@gmx.de
Cc: htejun@gmail.com
Cc: linuxppc-dev@lists.ozlabs.org
Cc: tj@kernel.org
Cc: yangds.fnst@cn.fujitsu.com
Link: http://lkml.kernel.org/r/20160406215950.04bc3f0b@kryten
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/sched/cpuacct.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c
index df947e0..41f85c4 100644
--- a/kernel/sched/cpuacct.c
+++ b/kernel/sched/cpuacct.c
@@ -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();
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [tip:sched/core] sched/cpuacct: Split usage accounting into user_usage and sys_usage Srikar Dronamraju <srikar@linux.vnet.ibm.com> - 2016-04-04 16:10 +0200
Re: [tip:sched/core] sched/cpuacct: Split usage accounting into user_usage and sys_usage Ingo Molnar <mingo@kernel.org> - 2016-04-06 09:00 +0200
RE: [tip:sched/core] sched/cpuacct: Split usage accounting into user_usage and sys_usage Zhao Lei <zhaolei@cn.fujitsu.com> - 2016-04-06 09:50 +0200
Re: [tip:sched/core] sched/cpuacct: Split usage accounting into user_usage and sys_usage Peter Zijlstra <peterz@infradead.org> - 2016-04-06 10:00 +0200
Re: [tip:sched/core] sched/cpuacct: Split usage accounting into user_usage and sys_usage Anton Blanchard <anton@samba.org> - 2016-04-06 12:40 +0200
Re: [tip:sched/core] sched/cpuacct: Split usage accounting into user_usage and sys_usage Peter Zijlstra <peterz@infradead.org> - 2016-04-06 13:10 +0200
RE: [tip:sched/core] sched/cpuacct: Split usage accounting into user_usage and sys_usage Zhao Lei <zhaolei@cn.fujitsu.com> - 2016-04-06 13:50 +0200
[PATCH] sched/cpuacct: Check for NULL when using task_pt_regs() Anton Blanchard <anton@samba.org> - 2016-04-06 14:10 +0200
Re: [PATCH] sched/cpuacct: Check for NULL when using task_pt_regs() Srikar Dronamraju <srikar@linux.vnet.ibm.com> - 2016-04-06 16:40 +0200
RE: [PATCH] sched/cpuacct: Check for NULL when using task_pt_regs() Zhao Lei <zhaolei@cn.fujitsu.com> - 2016-04-06 19:10 +0200
Re: [PATCH] sched/cpuacct: Check for NULL when using task_pt_regs() Ingo Molnar <mingo@kernel.org> - 2016-04-13 09:50 +0200
Re: [PATCH] sched/cpuacct: Check for NULL when using task_pt_regs() Michael Ellerman <mpe@ellerman.id.au> - 2016-04-13 13:10 +0200
Re: [PATCH] sched/cpuacct: Check for NULL when using task_pt_regs() Ingo Molnar <mingo@kernel.org> - 2016-04-13 13:30 +0200
Ping? Re: [PATCH] sched/cpuacct: Check for NULL when using task_pt_regs() Michael Ellerman <mpe@ellerman.id.au> - 2016-04-11 08:20 +0200
[tip:sched/core] sched/cpuacct: Check for NULL when using task_pt_regs() tip-bot for Anton Blanchard <tipbot@zytor.com> - 2016-04-13 14:00 +0200
csiph-web