]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
f863c98d1e3be17e17cbbe440cc1b0b13f27838f
[thirdparty/kernel/stable-queue.git] /
1 From foo@baz Mon May 28 08:52:37 CEST 2018
2 From: Peter Malone <peter.malone@gmail.com>
3 Date: Wed, 7 Mar 2018 14:00:34 +0100
4 Subject: fbdev: Fixing arbitrary kernel leak in case FBIOGETCMAP_SPARC in sbusfb_ioctl_helper().
5
6 From: Peter Malone <peter.malone@gmail.com>
7
8 [ Upstream commit 250c6c49e3b68756b14983c076183568636e2bde ]
9
10 Fixing arbitrary kernel leak in case FBIOGETCMAP_SPARC in
11 sbusfb_ioctl_helper().
12
13 'index' is defined as an int in sbusfb_ioctl_helper().
14 We retrieve this from the user:
15 if (get_user(index, &c->index) ||
16 __get_user(count, &c->count) ||
17 __get_user(ured, &c->red) ||
18 __get_user(ugreen, &c->green) ||
19 __get_user(ublue, &c->blue))
20 return -EFAULT;
21
22 and then we use 'index' in the following way:
23 red = cmap->red[index + i] >> 8;
24 green = cmap->green[index + i] >> 8;
25 blue = cmap->blue[index + i] >> 8;
26
27 This is a classic information leak vulnerability. 'index' should be
28 an unsigned int, given its usage above.
29
30 This patch is straight-forward; it changes 'index' to unsigned int
31 in two switch-cases: FBIOGETCMAP_SPARC && FBIOPUTCMAP_SPARC.
32
33 This patch fixes CVE-2018-6412.
34
35 Signed-off-by: Peter Malone <peter.malone@gmail.com>
36 Acked-by: Mathieu Malaterre <malat@debian.org>
37 Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
38 Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
39 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
40 ---
41 drivers/video/fbdev/sbuslib.c | 4 ++--
42 1 file changed, 2 insertions(+), 2 deletions(-)
43
44 --- a/drivers/video/fbdev/sbuslib.c
45 +++ b/drivers/video/fbdev/sbuslib.c
46 @@ -121,7 +121,7 @@ int sbusfb_ioctl_helper(unsigned long cm
47 unsigned char __user *ured;
48 unsigned char __user *ugreen;
49 unsigned char __user *ublue;
50 - int index, count, i;
51 + unsigned int index, count, i;
52
53 if (get_user(index, &c->index) ||
54 __get_user(count, &c->count) ||
55 @@ -160,7 +160,7 @@ int sbusfb_ioctl_helper(unsigned long cm
56 unsigned char __user *ugreen;
57 unsigned char __user *ublue;
58 struct fb_cmap *cmap = &info->cmap;
59 - int index, count, i;
60 + unsigned int index, count, i;
61 u8 red, green, blue;
62
63 if (get_user(index, &c->index) ||