drm/exynos: consider exception case to fb handle creation
authorInki Dae <inki.dae@samsung.com>
Tue, 29 Jan 2013 08:51:09 +0000 (17:51 +0900)
committerInki Dae <inki.dae@samsung.com>
Thu, 21 Feb 2013 06:00:26 +0000 (15:00 +0900)
GETFB ioctl request creates a new handle to only one gem object
so it should check if the given fb has one gem object.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
drivers/gpu/drm/exynos/exynos_drm_fb.c

index 294c0513f587901a15fdd9e57de8c3c48fdf3d34..31d4cb19736e4bb3345cfa9a0a03cb1c9b8ad3f5 100644 (file)
@@ -99,6 +99,10 @@ static int exynos_drm_fb_create_handle(struct drm_framebuffer *fb,
 
        DRM_DEBUG_KMS("%s\n", __FILE__);
 
+       /* This fb should have only one gem object. */
+       if (WARN_ON(exynos_fb->buf_cnt != 1))
+               return -EINVAL;
+
        return drm_gem_handle_create(file_priv,
                        &exynos_fb->exynos_gem_obj[0]->base, handle);
 }