|
@@ -170,6 +170,14 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
|
|
}
|
|
}
|
|
DRM_DEBUG("offset = 0x%08llx, size = 0x%08lx, type = %d\n",
|
|
DRM_DEBUG("offset = 0x%08llx, size = 0x%08lx, type = %d\n",
|
|
(unsigned long long)map->offset, map->size, map->type);
|
|
(unsigned long long)map->offset, map->size, map->type);
|
|
|
|
+
|
|
|
|
+ /* page-align _DRM_SHM maps. They are allocated here so there is no security
|
|
|
|
+ * hole created by that and it works around various broken drivers that use
|
|
|
|
+ * a non-aligned quantity to map the SAREA. --BenH
|
|
|
|
+ */
|
|
|
|
+ if (map->type == _DRM_SHM)
|
|
|
|
+ map->size = PAGE_ALIGN(map->size);
|
|
|
|
+
|
|
if ((map->offset & (~(resource_size_t)PAGE_MASK)) || (map->size & (~PAGE_MASK))) {
|
|
if ((map->offset & (~(resource_size_t)PAGE_MASK)) || (map->size & (~PAGE_MASK))) {
|
|
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
|
|
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
|
|
return -EINVAL;
|
|
return -EINVAL;
|