lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-bd92883051a0228cc34996b8e766111ba10c9aac@git.kernel.org>
Date:	Wed, 13 Apr 2016 04:49:34 -0700
From:	tip-bot for Anton Blanchard <tipbot@...or.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	hpa@...or.com, anton@...ba.org, torvalds@...ux-foundation.org,
	linux-kernel@...r.kernel.org, sfr@...b.auug.org.au,
	peterz@...radead.org, mpe@...erman.id.au, zhaolei@...fujitsu.com,
	mingo@...nel.org, srikar@...ux.vnet.ibm.com, tglx@...utronix.de
Subject: [tip:sched/core] sched/cpuacct: Check for NULL when using
 task_pt_regs()

Commit-ID:  bd92883051a0228cc34996b8e766111ba10c9aac
Gitweb:     http://git.kernel.org/tip/bd92883051a0228cc34996b8e766111ba10c9aac
Author:     Anton Blanchard <anton@...ba.org>
AuthorDate: Wed, 6 Apr 2016 21:59:50 +1000
Committer:  Ingo Molnar <mingo@...nel.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@...ux.vnet.ibm.com>
Tested-by: Zhao Lei <zhaolei@...fujitsu.com>
Signed-off-by: Anton Blanchard <anton@...ba.org>
Acked-by: Zhao Lei <zhaolei@...fujitsu.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Michael Ellerman <mpe@...erman.id.au>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Stephen Rothwell <sfr@...b.auug.org.au>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: efault@....de
Cc: htejun@...il.com
Cc: linuxppc-dev@...ts.ozlabs.org
Cc: tj@...nel.org
Cc: yangds.fnst@...fujitsu.com
Link: http://lkml.kernel.org/r/20160406215950.04bc3f0b@kryten
Signed-off-by: Ingo Molnar <mingo@...nel.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();
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ