]>
Commit | Line | Data |
---|---|---|
0aa96192 GKH |
1 | From 8832317f662c06f5c06e638f57bfe89a71c9b266 Mon Sep 17 00:00:00 2001 |
2 | From: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> | |
3 | Date: Fri, 16 Oct 2015 15:53:29 +0530 | |
4 | Subject: powerpc/rtas: Validate rtas.entry before calling enter_rtas() | |
5 | ||
6 | From: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> | |
7 | ||
8 | commit 8832317f662c06f5c06e638f57bfe89a71c9b266 upstream. | |
9 | ||
10 | Currently we do not validate rtas.entry before calling enter_rtas(). This | |
11 | leads to a kernel oops when user space calls rtas system call on a powernv | |
12 | platform (see below). This patch adds code to validate rtas.entry before | |
13 | making 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 | ||
29 | Fixes: 55190f88789a ("powerpc: Add skeleton PowerNV platform") | |
30 | Reported-by: NAGESWARA R. SASTRY <nasastry@in.ibm.com> | |
31 | Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> | |
32 | [mpe: Reword change log, trim oops, and add stable + fixes] | |
33 | Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> | |
34 | Signed-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 |