]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.14.57/powerpc-rtas-validate-rtas.entry-before-calling-enter_rtas.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.14.57 / powerpc-rtas-validate-rtas.entry-before-calling-enter_rtas.patch
CommitLineData
0aa96192
GKH
1From 8832317f662c06f5c06e638f57bfe89a71c9b266 Mon Sep 17 00:00:00 2001
2From: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
3Date: Fri, 16 Oct 2015 15:53:29 +0530
4Subject: powerpc/rtas: Validate rtas.entry before calling enter_rtas()
5
6From: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
7
8commit 8832317f662c06f5c06e638f57bfe89a71c9b266 upstream.
9
10Currently we do not validate rtas.entry before calling enter_rtas(). This
11leads to a kernel oops when user space calls rtas system call on a powernv
12platform (see below). This patch adds code to validate rtas.entry before
13making enter_rtas() call.
14
15 Oops: Exception in kernel mode, sig: 4 [#1]
16 SMP NR_CPUS=1024 NUMA PowerNV
17 task: c000000004294b80 ti: c0000007e1a78000 task.ti: c0000007e1a78000
18 NIP: 0000000000000000 LR: 0000000000009c14 CTR: c000000000423140
19 REGS: c0000007e1a7b920 TRAP: 0e40 Not tainted (3.18.17-340.el7_1.pkvm3_1_0.2400.1.ppc64le)
20 MSR: 1000000000081000 <HV,ME> CR: 00000000 XER: 00000000
21 CFAR: c000000000009c0c SOFTE: 0
22 NIP [0000000000000000] (null)
23 LR [0000000000009c14] 0x9c14
24 Call Trace:
25 [c0000007e1a7bba0] [c00000000041a7f4] avc_has_perm_noaudit+0x54/0x110 (unreliable)
26 [c0000007e1a7bd80] [c00000000002ddc0] ppc_rtas+0x150/0x2d0
27 [c0000007e1a7be30] [c000000000009358] syscall_exit+0x0/0x98
28
29Fixes: 55190f88789a ("powerpc: Add skeleton PowerNV platform")
30Reported-by: NAGESWARA R. SASTRY <nasastry@in.ibm.com>
31Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
32[mpe: Reword change log, trim oops, and add stable + fixes]
33Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
34Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
35
36---
37 arch/powerpc/kernel/rtas.c | 3 +++
38 1 file changed, 3 insertions(+)
39
40--- a/arch/powerpc/kernel/rtas.c
41+++ b/arch/powerpc/kernel/rtas.c
42@@ -1041,6 +1041,9 @@ asmlinkage int ppc_rtas(struct rtas_args
43 if (!capable(CAP_SYS_ADMIN))
44 return -EPERM;
45
46+ if (!rtas.entry)
47+ return -EINVAL;
48+
49 if (copy_from_user(&args, uargs, 3 * sizeof(u32)) != 0)
50 return -EFAULT;
51