DivestOS/Patches/Linux_CVEs/CVE-2016-2468/ANY/1.patch
2017-10-29 22:14:37 -04:00

25 lines
745 B
Diff

diff --git a/drivers/gpu/msm/kgsl_sharedmem.c b/drivers/gpu/msm/kgsl_sharedmem.c
index 29f6162..a138719 100644
--- a/drivers/gpu/msm/kgsl_sharedmem.c
+++ b/drivers/gpu/msm/kgsl_sharedmem.c
@@ -592,13 +592,18 @@
size_t size)
{
int pcount = 0, order, ret = 0;
- int j, len, page_size, sglen_alloc, sglen = 0;
+ int j, page_size, sglen_alloc, sglen = 0;
struct page **pages = NULL;
pgprot_t page_prot = pgprot_writecombine(PAGE_KERNEL);
void *ptr;
+ size_t len;
unsigned int align;
int step = SZ_2M >> PAGE_SHIFT;
+ size = PAGE_ALIGN(size);
+ if (size == 0 || size > UINT_MAX)
+ return -EINVAL;
+
align = (memdesc->flags & KGSL_MEMALIGN_MASK) >> KGSL_MEMALIGN_SHIFT;
page_size = (align >= ilog2(SZ_64K) && size >= SZ_64K)