aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/drm_bufs.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index 6d80d17f1e96..0411d912d82a 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -170,6 +170,14 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
170 } 170 }
171 DRM_DEBUG("offset = 0x%08llx, size = 0x%08lx, type = %d\n", 171 DRM_DEBUG("offset = 0x%08llx, size = 0x%08lx, type = %d\n",
172 (unsigned long long)map->offset, map->size, map->type); 172 (unsigned long long)map->offset, map->size, map->type);
173
174 /* page-align _DRM_SHM maps. They are allocated here so there is no security
175 * hole created by that and it works around various broken drivers that use
176 * a non-aligned quantity to map the SAREA. --BenH
177 */
178 if (map->type == _DRM_SHM)
179 map->size = PAGE_ALIGN(map->size);
180
173 if ((map->offset & (~(resource_size_t)PAGE_MASK)) || (map->size & (~PAGE_MASK))) { 181 if ((map->offset & (~(resource_size_t)PAGE_MASK)) || (map->size & (~PAGE_MASK))) {
174 drm_free(map, sizeof(*map), DRM_MEM_MAPS); 182 drm_free(map, sizeof(*map), DRM_MEM_MAPS);
175 return -EINVAL; 183 return -EINVAL;