diff options
Diffstat (limited to 'drivers/gpu/drm/drm_edid.c')
-rw-r--r-- | drivers/gpu/drm/drm_edid.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 3c0d2b3aed76..cea665d86dd3 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c | |||
@@ -626,6 +626,12 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev, | |||
626 | return NULL; | 626 | return NULL; |
627 | } | 627 | } |
628 | 628 | ||
629 | /* it is incorrect if hsync/vsync width is zero */ | ||
630 | if (!hsync_pulse_width || !vsync_pulse_width) { | ||
631 | DRM_DEBUG_KMS("Incorrect Detailed timing. " | ||
632 | "Wrong Hsync/Vsync pulse width\n"); | ||
633 | return NULL; | ||
634 | } | ||
629 | mode = drm_mode_create(dev); | 635 | mode = drm_mode_create(dev); |
630 | if (!mode) | 636 | if (!mode) |
631 | return NULL; | 637 | return NULL; |
@@ -647,6 +653,15 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev, | |||
647 | mode->vsync_end = mode->vsync_start + vsync_pulse_width; | 653 | mode->vsync_end = mode->vsync_start + vsync_pulse_width; |
648 | mode->vtotal = mode->vdisplay + vblank; | 654 | mode->vtotal = mode->vdisplay + vblank; |
649 | 655 | ||
656 | /* perform the basic check for the detailed timing */ | ||
657 | if (mode->hsync_end > mode->htotal || | ||
658 | mode->vsync_end > mode->vtotal) { | ||
659 | drm_mode_destroy(dev, mode); | ||
660 | DRM_DEBUG_KMS("Incorrect detailed timing. " | ||
661 | "Sync is beyond the blank.\n"); | ||
662 | return NULL; | ||
663 | } | ||
664 | |||
650 | drm_mode_set_name(mode); | 665 | drm_mode_set_name(mode); |
651 | 666 | ||
652 | if (pt->misc & DRM_EDID_PT_INTERLACED) | 667 | if (pt->misc & DRM_EDID_PT_INTERLACED) |