OSDN Git Service

msm: kgsl: Add missing check for size against lower VA
authorRajesh Kemisetti <rajeshk@codeaurora.org>
Thu, 10 Dec 2015 10:30:00 +0000 (16:00 +0530)
committerDavid Keitel <dkeitel@codeaurora.org>
Thu, 24 Mar 2016 04:14:53 +0000 (21:14 -0700)
_get_unmapped_area_topdown() subtracts the requested size
from lower entry base without really checking its value.

This leads to overflow while working at boundary conditions.

Add a condition to check entry base with the size and proceed.

Change-Id: Ic695da683b11de35c7c4b8936a35d693dc8fa452
Signed-off-by: Rajesh Kemisetti <rajeshk@codeaurora.org>
drivers/gpu/msm/kgsl_iommu.c

index 1d9bc37..a0e8447 100644 (file)
@@ -1661,7 +1661,7 @@ static uint64_t _get_unmapped_area_topdown(struct kgsl_pagetable *pagetable,
                 * the bottom of the previous one
                 */
 
-               if (offset < end) {
+               if ((end > size) && (offset < end)) {
                        uint64_t chunk = (end - size) & mask;
 
                        if (chunk >= offset)