Skip to content

Commit 865afb1

Browse files
agnersdanvet
authored andcommitted
drm/fb-helper: reject any changes to the fbdev
The current fbdev emulation does not allow to push back changes in width, height or depth to KMS, hence reject any changes with an error. This makes sure that fbdev ioctl's fail properly and user space does not assume that changes succeeded. Signed-off-by: Stefan Agner <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent a28187c commit 865afb1

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

drivers/gpu/drm/drm_fb_helper.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,11 +1209,14 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
12091209
if (var->pixclock != 0 || in_dbg_master())
12101210
return -EINVAL;
12111211

1212-
/* Need to resize the fb object !!! */
1213-
if (var->bits_per_pixel > fb->bits_per_pixel ||
1214-
var->xres > fb->width || var->yres > fb->height ||
1215-
var->xres_virtual > fb->width || var->yres_virtual > fb->height) {
1216-
DRM_DEBUG("fb userspace requested width/height/bpp is greater than current fb "
1212+
/*
1213+
* Changes struct fb_var_screeninfo are currently not pushed back
1214+
* to KMS, hence fail if different settings are requested.
1215+
*/
1216+
if (var->bits_per_pixel != fb->bits_per_pixel ||
1217+
var->xres != fb->width || var->yres != fb->height ||
1218+
var->xres_virtual != fb->width || var->yres_virtual != fb->height) {
1219+
DRM_DEBUG("fb userspace requested width/height/bpp different than current fb "
12171220
"request %dx%d-%d (virtual %dx%d) > %dx%d-%d\n",
12181221
var->xres, var->yres, var->bits_per_pixel,
12191222
var->xres_virtual, var->yres_virtual,

0 commit comments

Comments
 (0)