aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2013-12-16 07:39:31 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-17 20:12:55 -0500
commitfd6040ed57d8f200ab0cc2abf706c54995a48370 (patch)
treecf23030e471ce6afa0c312e46b6dc81635bda205
parent9fe73d46edd358fc154f7332c8ff312e067255a0 (diff)
imx-drm: imx-drm-core: improve safety of imx_drm_add_crtc()
We must not add more CRTCs than we have declared to the vblank helpers, otherwise we overflow their arrays. Force failure if we exceed the number of CRTCs. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Acked-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/imx-drm/imx-drm-core.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c
index 19e431dee493..96e4eee344ef 100644
--- a/drivers/staging/imx-drm/imx-drm-core.c
+++ b/drivers/staging/imx-drm/imx-drm-core.c
@@ -501,6 +501,15 @@ int imx_drm_add_crtc(struct drm_crtc *crtc,
501 501
502 mutex_lock(&imxdrm->mutex); 502 mutex_lock(&imxdrm->mutex);
503 503
504 /*
505 * The vblank arrays are dimensioned by MAX_CRTC - we can't
506 * pass IDs greater than this to those functions.
507 */
508 if (imxdrm->pipes >= MAX_CRTC) {
509 ret = -EINVAL;
510 goto err_busy;
511 }
512
504 if (imxdrm->drm->open_count) { 513 if (imxdrm->drm->open_count) {
505 ret = -EBUSY; 514 ret = -EBUSY;
506 goto err_busy; 515 goto err_busy;