File tree Expand file tree Collapse file tree 1 file changed +18
-16
lines changed Expand file tree Collapse file tree 1 file changed +18
-16
lines changed Original file line number Diff line number Diff line change @@ -468,29 +468,31 @@ int drm_mode_getfb(struct drm_device *dev,
468
468
goto out ;
469
469
}
470
470
471
+ if (!fb -> funcs -> create_handle ) {
472
+ ret = - ENODEV ;
473
+ goto out ;
474
+ }
475
+
471
476
r -> height = fb -> height ;
472
477
r -> width = fb -> width ;
473
478
r -> depth = fb -> format -> depth ;
474
479
r -> bpp = fb -> format -> cpp [0 ] * 8 ;
475
480
r -> pitch = fb -> pitches [0 ];
476
- if (fb -> funcs -> create_handle ) {
477
- if (drm_is_current_master (file_priv ) || capable (CAP_SYS_ADMIN ) ||
478
- drm_is_control_client (file_priv )) {
479
- ret = fb -> funcs -> create_handle (fb , file_priv ,
480
- & r -> handle );
481
- } else {
482
- /* GET_FB() is an unprivileged ioctl so we must not
483
- * return a buffer-handle to non-master processes! For
484
- * backwards-compatibility reasons, we cannot make
485
- * GET_FB() privileged, so just return an invalid handle
486
- * for non-masters. */
487
- r -> handle = 0 ;
488
- ret = 0 ;
489
- }
490
- } else {
491
- ret = - ENODEV ;
481
+
482
+ /* GET_FB() is an unprivileged ioctl so we must not return a
483
+ * buffer-handle to non-master processes! For
484
+ * backwards-compatibility reasons, we cannot make GET_FB() privileged,
485
+ * so just return an invalid handle for non-masters.
486
+ */
487
+ if (!drm_is_current_master (file_priv ) && !capable (CAP_SYS_ADMIN ) &&
488
+ !drm_is_control_client (file_priv )) {
489
+ r -> handle = 0 ;
490
+ ret = 0 ;
491
+ goto out ;
492
492
}
493
493
494
+ ret = fb -> funcs -> create_handle (fb , file_priv , & r -> handle );
495
+
494
496
out :
495
497
drm_framebuffer_put (fb );
496
498
You can’t perform that action at this time.
0 commit comments