Skip to contentSkip to conversation

media: pci: meye: validate offset to avoid arbitrary access

PATCH New Lao Wei 1 participant 1 message Jul 9, 2018 Media (V4L/DVB)

lore
Share & tools
lore

Lao Wei

author
#0 lore raw

PATCH 1/1 media: pci: meye: validate offset to avoid arbitrary access

From: Lao Wei <[email protected]>

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

---
 drivers/media/pci/meye/meye.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/pci/meye/meye.c +1 -1
index 8001d3e..db2a7ad 100644
@@ -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;
 	}
Signature · 1 line
1.8.5.6