summaryrefslogtreecommitdiffstats
path: root/patches/cve/CVE-2018-8781-drm-udl-Properly-check-framebuffer-mmap-offsets.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/cve/CVE-2018-8781-drm-udl-Properly-check-framebuffer-mmap-offsets.patch')
-rw-r--r--patches/cve/CVE-2018-8781-drm-udl-Properly-check-framebuffer-mmap-offsets.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/patches/cve/CVE-2018-8781-drm-udl-Properly-check-framebuffer-mmap-offsets.patch b/patches/cve/CVE-2018-8781-drm-udl-Properly-check-framebuffer-mmap-offsets.patch
new file mode 100644
index 0000000..e8fecb6
--- /dev/null
+++ b/patches/cve/CVE-2018-8781-drm-udl-Properly-check-framebuffer-mmap-offsets.patch
@@ -0,0 +1,49 @@
1From 4ac9ab4f5f45d1ad0585c7bfa9ccff43b9984045 Mon Sep 17 00:00:00 2001
2From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3Date: Wed, 21 Mar 2018 16:45:53 +0100
4Subject: [PATCH] drm: udl: Properly check framebuffer mmap offsets
5
6commit 3b82a4db8eaccce735dffd50b4d4e1578099b8e8 upstream.
7
8The memmap options sent to the udl framebuffer driver were not being
9checked for all sets of possible crazy values. Fix this up by properly
10bounding the allowed values.
11
12CVE: CVE-2018-8781
13Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.9.y&id=4ac9ab4f5f45d1ad0585c7bfa9ccff43b9984045]
14
15Reported-by: Eyal Itkin <eyalit@checkpoint.com>
16Cc: stable <stable@vger.kernel.org>
17Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
19Link: https://patchwork.freedesktop.org/patch/msgid/20180321154553.GA18454@kroah.com
20Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21Signed-off-by: Andreas Wellving <andreas.wellving@enea.com>
22---
23 drivers/gpu/drm/udl/udl_fb.c | 9 +++++++--
24 1 file changed, 7 insertions(+), 2 deletions(-)
25
26diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
27index 611b6b9bb3cb..67ea2ce03a23 100644
28--- a/drivers/gpu/drm/udl/udl_fb.c
29+++ b/drivers/gpu/drm/udl/udl_fb.c
30@@ -158,10 +158,15 @@ static int udl_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
31 {
32 unsigned long start = vma->vm_start;
33 unsigned long size = vma->vm_end - vma->vm_start;
34- unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
35+ unsigned long offset;
36 unsigned long page, pos;
37
38- if (offset + size > info->fix.smem_len)
39+ if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT))
40+ return -EINVAL;
41+
42+ offset = vma->vm_pgoff << PAGE_SHIFT;
43+
44+ if (offset > info->fix.smem_len || size > info->fix.smem_len - offset)
45 return -EINVAL;
46
47 pos = (unsigned long)info->fix.smem_start + offset;
48
49