]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
media: fix: media: pci: meye: validate offset to avoid arbitrary access
authorLao Wei <zrlw@qq.com>
Mon, 9 Jul 2018 12:15:53 +0000 (08:15 -0400)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 26 Nov 2019 12:16:36 +0000 (13:16 +0100)
BugLink: https://bugs.launchpad.net/bugs/1853915
[ Upstream commit eac7230fdb4672c2cb56f6a01a1744f562c01f80 ]

Motion eye video4linux driver for Sony Vaio PictureBook desn't validate user-controlled parameter
'vma->vm_pgoff', a malicious process might access all of kernel memory from user space by trying
pass different arbitrary address.
Discussion: http://www.openwall.com/lists/oss-security/2018/07/06/1

Signed-off-by: Lao Wei <zrlw@qq.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/media/pci/meye/meye.c

index 23999a8cef37763abc52df42360d6730fae587ad..67e37bea728a0b63fad1ffc3d52884262a17378d 100644 (file)
@@ -1460,7 +1460,7 @@ static int meye_mmap(struct file *file, struct vm_area_struct *vma)
        unsigned long page, pos;
 
        mutex_lock(&meye.lock);
-       if (size > gbuffers * gbufsize) {
+       if (size > gbuffers * gbufsize || offset > gbuffers * gbufsize - size) {
                mutex_unlock(&meye.lock);
                return -EINVAL;
        }