]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.18.62/vt-fix-unchecked-__put_user-in-tioclinux-ioctls.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.18.62 / vt-fix-unchecked-__put_user-in-tioclinux-ioctls.patch
1 From 6987dc8a70976561d22450b5858fc9767788cc1c Mon Sep 17 00:00:00 2001
2 From: Adam Borowski <kilobyte@angband.pl>
3 Date: Sat, 3 Jun 2017 09:35:06 +0200
4 Subject: vt: fix unchecked __put_user() in tioclinux ioctls
5
6 From: Adam Borowski <kilobyte@angband.pl>
7
8 commit 6987dc8a70976561d22450b5858fc9767788cc1c upstream.
9
10 Only read access is checked before this call.
11
12 Actually, at the moment this is not an issue, as every in-tree arch does
13 the same manual checks for VERIFY_READ vs VERIFY_WRITE, relying on the MMU
14 to tell them apart, but this wasn't the case in the past and may happen
15 again on some odd arch in the future.
16
17 If anyone cares about 3.7 and earlier, this is a security hole (untested)
18 on real 80386 CPUs.
19
20 Signed-off-by: Adam Borowski <kilobyte@angband.pl>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22
23 ---
24 drivers/tty/vt/vt.c | 6 +++---
25 1 file changed, 3 insertions(+), 3 deletions(-)
26
27 --- a/drivers/tty/vt/vt.c
28 +++ b/drivers/tty/vt/vt.c
29 @@ -2687,13 +2687,13 @@ int tioclinux(struct tty_struct *tty, un
30 * related to the kernel should not use this.
31 */
32 data = vt_get_shift_state();
33 - ret = __put_user(data, p);
34 + ret = put_user(data, p);
35 break;
36 case TIOCL_GETMOUSEREPORTING:
37 console_lock(); /* May be overkill */
38 data = mouse_reporting();
39 console_unlock();
40 - ret = __put_user(data, p);
41 + ret = put_user(data, p);
42 break;
43 case TIOCL_SETVESABLANK:
44 console_lock();
45 @@ -2702,7 +2702,7 @@ int tioclinux(struct tty_struct *tty, un
46 break;
47 case TIOCL_GETKMSGREDIRECT:
48 data = vt_get_kmsg_redirect();
49 - ret = __put_user(data, p);
50 + ret = put_user(data, p);
51 break;
52 case TIOCL_SETKMSGREDIRECT:
53 if (!capable(CAP_SYS_ADMIN)) {