summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLao Wei <zrlw@qq.com>2018-07-09 08:15:53 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-11-25 15:53:56 +0100
commit24293b23bca5c05b4e047daaed37d3d38d50a8dc (patch)
tree96b17a69f50d934bc116cafb11633cae4ca50007
parentcdf4e8eae639d9fc085f974aa9958b8eaeb1fd02 (diff)
media: fix: media: pci: meye: validate offset to avoid arbitrary access
[ 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>
-rw-r--r--drivers/media/pci/meye/meye.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/pci/meye/meye.c b/drivers/media/pci/meye/meye.c
index ba887e8e1b17..a85c5199ccd3 100644
--- a/drivers/media/pci/meye/meye.c
+++ b/drivers/media/pci/meye/meye.c
@@ -1469,7 +1469,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;
}