The problem is the drm_mode_setcrtc function does not check
whether allocation of new display mode succeeded or not.

Signed-off-by: Martin Hurton <[email protected]>
---
 drivers/gpu/drm/drm_crtc.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 94a7688..1a3d6b6 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1451,6 +1451,11 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
                }
 
                mode = drm_mode_create(dev);
+               if (!mode) {
+                       ret = -ENOMEM;
+                       goto out;
+               }
+
                drm_crtc_convert_umode(mode, &crtc_req->mode);
                drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
        }
-- 
1.6.2.4


------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to