From e96e1ac821118a042038ffab293557612c02e5c8 Mon Sep 17 00:00:00 2001 From: zrlw <40652892+zrlw@users.noreply.github.com> Date: Sun, 8 Jul 2018 16:04:29 +0800 Subject: [PATCH] Update meye.c validate user-controlled offset paramter to avoid arbitrary access. --- drivers/media/pci/meye/meye.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/pci/meye/meye.c b/drivers/media/pci/meye/meye.c index 8001d3e9134e44..db2a7ad1e52319 100644 --- a/drivers/media/pci/meye/meye.c +++ b/drivers/media/pci/meye/meye.c @@ -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; }