aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_fb_helper.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-03-26 16:15:53 -0400
committerDave Airlie <airlied@redhat.com>2012-04-03 06:18:46 -0400
commit62fb376e214d3c1bfdf6fbb77dac162f6da04d7e (patch)
treee740485e5c058ad0f8e22f26081c24014e127d5a /drivers/gpu/drm/drm_fb_helper.c
parente199fd422420d1620cf64fd9bdd4ff8bc255cc76 (diff)
drm: Validate requested virtual size against allocated fb size
mplayer -vo fbdev tries to create a screen that is twice as tall as the allocated framebuffer for "doublebuffering". By default, and all in-tree users, only sufficient memory is allocated and mapped to satisfy the smallest framebuffer and the virtual size is no larger than the actual. For these users, we should therefore reject any userspace request to create a screen that requires a buffer larger than the framebuffer originally allocated. References: https://bugs.freedesktop.org/show_bug.cgi?id=38138 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: stable@kernel.org Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_fb_helper.c')
-rw-r--r--drivers/gpu/drm/drm_fb_helper.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 7740dd26f007..a0d6e894d97c 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -559,9 +559,13 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
559 return -EINVAL; 559 return -EINVAL;
560 560
561 /* Need to resize the fb object !!! */ 561 /* Need to resize the fb object !!! */
562 if (var->bits_per_pixel > fb->bits_per_pixel || var->xres > fb->width || var->yres > fb->height) { 562 if (var->bits_per_pixel > fb->bits_per_pixel ||
563 var->xres > fb->width || var->yres > fb->height ||
564 var->xres_virtual > fb->width || var->yres_virtual > fb->height) {
563 DRM_DEBUG("fb userspace requested width/height/bpp is greater than current fb " 565 DRM_DEBUG("fb userspace requested width/height/bpp is greater than current fb "
564 "object %dx%d-%d > %dx%d-%d\n", var->xres, var->yres, var->bits_per_pixel, 566 "request %dx%d-%d (virtual %dx%d) > %dx%d-%d\n",
567 var->xres, var->yres, var->bits_per_pixel,
568 var->xres_virtual, var->yres_virtual,
565 fb->width, fb->height, fb->bits_per_pixel); 569 fb->width, fb->height, fb->bits_per_pixel);
566 return -EINVAL; 570 return -EINVAL;
567 } 571 }