aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_framebuffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/drm_framebuffer.c')
-rw-r--r--drivers/gpu/drm/drm_framebuffer.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index ad67203de715..bfedceff87bb 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -468,29 +468,30 @@ int drm_mode_getfb(struct drm_device *dev,
468 goto out; 468 goto out;
469 } 469 }
470 470
471 if (!fb->funcs->create_handle) {
472 ret = -ENODEV;
473 goto out;
474 }
475
471 r->height = fb->height; 476 r->height = fb->height;
472 r->width = fb->width; 477 r->width = fb->width;
473 r->depth = fb->format->depth; 478 r->depth = fb->format->depth;
474 r->bpp = fb->format->cpp[0] * 8; 479 r->bpp = fb->format->cpp[0] * 8;
475 r->pitch = fb->pitches[0]; 480 r->pitch = fb->pitches[0];
476 if (fb->funcs->create_handle) { 481
477 if (drm_is_current_master(file_priv) || capable(CAP_SYS_ADMIN) || 482 /* GET_FB() is an unprivileged ioctl so we must not return a
478 drm_is_control_client(file_priv)) { 483 * buffer-handle to non-master processes! For
479 ret = fb->funcs->create_handle(fb, file_priv, 484 * backwards-compatibility reasons, we cannot make GET_FB() privileged,
480 &r->handle); 485 * so just return an invalid handle for non-masters.
481 } else { 486 */
482 /* GET_FB() is an unprivileged ioctl so we must not 487 if (!drm_is_current_master(file_priv) && !capable(CAP_SYS_ADMIN)) {
483 * return a buffer-handle to non-master processes! For 488 r->handle = 0;
484 * backwards-compatibility reasons, we cannot make 489 ret = 0;
485 * GET_FB() privileged, so just return an invalid handle 490 goto out;
486 * for non-masters. */
487 r->handle = 0;
488 ret = 0;
489 }
490 } else {
491 ret = -ENODEV;
492 } 491 }
493 492
493 ret = fb->funcs->create_handle(fb, file_priv, &r->handle);
494
494out: 495out:
495 drm_framebuffer_put(fb); 496 drm_framebuffer_put(fb);
496 497