From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: David Airlie <airlied@linux.ie>
Cc: Tom Lendacky <thomas.lendacky@amd.com>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
Eyal Itkin <eyalit@checkpoint.com>,
Krzysztof Kozlowski <krzk@kernel.org>,
Cihangir Akturk <cakturk@gmail.com>,
dri-devel@lists.freedesktop.org, Ingo Molnar <mingo@kernel.org>
Subject: [PATCH] drm: udl: Properly check framebuffer mmap offsets
Date: Wed, 21 Mar 2018 16:45:53 +0100 [thread overview]
Message-ID: <20180321154553.GA18454@kroah.com> (raw)
The memmap options sent to the udl framebuffer driver were not being
checked for all sets of possible crazy values. Fix this up by properly
bounding the allowed values.
Reported-by: Eyal Itkin <eyalit@checkpoint.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
index b5b335c9b2bb..2ebdc6d5a76e 100644
--- a/drivers/gpu/drm/udl/udl_fb.c
+++ b/drivers/gpu/drm/udl/udl_fb.c
@@ -159,10 +159,15 @@ static int udl_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
{
unsigned long start = vma->vm_start;
unsigned long size = vma->vm_end - vma->vm_start;
- unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
+ unsigned long offset;
unsigned long page, pos;
- if (offset + size > info->fix.smem_len)
+ if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT))
+ return -EINVAL;
+
+ offset = vma->vm_pgoff << PAGE_SHIFT;
+
+ if (offset > info->fix.smem_len || size > info->fix.smem_len - offset)
return -EINVAL;
pos = (unsigned long)info->fix.smem_start + offset;
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next reply other threads:[~2018-03-21 15:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-21 15:45 Greg Kroah-Hartman [this message]
2018-03-22 6:59 ` [PATCH] drm: udl: Properly check framebuffer mmap offsets Daniel Vetter
2018-03-22 8:03 ` Greg Kroah-Hartman
2018-03-22 9:54 ` Daniel Vetter
2018-03-22 9:54 ` Daniel Vetter
2018-03-23 0:14 ` Kees Cook
2018-03-26 8:26 ` Daniel Vetter
2018-03-26 8:26 ` Daniel Vetter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180321154553.GA18454@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=airlied@linux.ie \
--cc=cakturk@gmail.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=eyalit@checkpoint.com \
--cc=krzk@kernel.org \
--cc=mingo@kernel.org \
--cc=thomas.lendacky@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.