From patchwork Thu Jan 10 10:35:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seung-Woo Kim X-Patchwork-Id: 1959461 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 67747DF264 for ; Thu, 10 Jan 2013 10:35:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 605F0E6B22 for ; Thu, 10 Jan 2013 02:35:28 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 2AC1AE678D for ; Thu, 10 Jan 2013 02:35:03 -0800 (PST) Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MGE00FQOO292Q10@mailout1.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 10 Jan 2013 19:35:02 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.43]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 59.D6.12699.6599EE05; Thu, 10 Jan 2013 19:35:02 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-af-50ee9956a2f9 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id F8.D6.12699.6599EE05; Thu, 10 Jan 2013 19:35:02 +0900 (KST) Received: from localhost.localdomain ([10.90.51.68]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MGE007TNO2BGA10@mmp1.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 10 Jan 2013 19:35:01 +0900 (KST) From: Seung-Woo Kim To: dri-devel@lists.freedesktop.org, inki.dae@samsung.com Subject: [PATCH] drm/exynos: added validation of edid for vidi connection Date: Thu, 10 Jan 2013 19:35:06 +0900 Message-id: <1357814106-23131-1-git-send-email-sw0312.kim@samsung.com> X-Mailer: git-send-email 1.7.4.1 DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrKLMWRmVeSWpSXmKPExsVy+t8zbd2wme8CDPav4bO48vU9mwOjx/3u 40wBjFFcNimpOZllqUX6dglcGYsnNrAU/OOo2HvtKWMD42H2LkZODgkBE4n5t+4zQ9hiEhfu rWfrYuTiEBJYxigxZfVNFpii/sutrBCJRYwS639uZIRwVjBJnHwwAWwUm4COxP4lv1lBbBEB S4kHW3+DjWUWcJdofnkMLC4s4ClxunkXE4jNIqAqse3UYbA4r4CbxNyOCawQ2xQkFtx7ywZR IyDxbfIhoCs4gOKyEpsOMIPslRDYwSZx+fNmqLMlJQ6uuMEygVFwASPDKkbR1ILkguKk9Fwj veLE3OLSvHS95PzcTYyQsJLewbiqweIQowAHoxIPr5bvuwAh1sSy4srcQ4wSHMxKIrwh298G CPGmJFZWpRblxxeV5qQWH2L0AbpkIrOUaHI+MOTzSuINjQ2MDQ0tDc1MLU0NcAgrifMynnoS ICSQnliSmp2aWpBaBDOOiYNTqoHR+KBD+JLDrf4Wq76cdmq6sKrnkMidRLk1ZRvfFmwzWHdD OXyugJsQo0bU3DBtq6W1kj3vOR6XiVl1tWpNafs5z1l69VPuninTjN+olEr+FzdXTAyf6LLv sWiTDf/3y2sPvPKVn8tUKPivMO654tfwpaf62Xhz7mlvYGZ0s56adazq32aOGT5KLMUZiYZa zEXFiQB1hVQeWAIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrCLMWRmVeSWpSXmKPExsVy+t9jAd2wme8CDCZdZLe48vU9mwOjx/3u 40wBjFENjDYZqYkpqUUKqXnJ+SmZeem2St7B8c7xpmYGhrqGlhbmSgp5ibmptkouPgG6bpk5 QGOVFMoSc0qBQgGJxcVK+naYJoSGuOlawDRG6PqGBMH1GBmggYR1jBmLJzawFPzjqNh77Slj A+Nh9i5GTg4JAROJ/sutrBC2mMSFe+vZuhi5OIQEFjFKrP+5kRHCWcEkcfLBBLAONgEdif1L foN1iAhYSjzY+psZxGYWcJdofnkMLC4s4ClxunkXE4jNIqAqse3UYbA4r4CbxNyOCVDbFCQW 3HvLNoGRewEjwypG0dSC5ILipPRcI73ixNzi0rx0veT83E2M4KB9Jr2DcVWDxSFGAQ5GJR5e Ld93AUKsiWXFlbmHGCU4mJVEeEO2vw0Q4k1JrKxKLcqPLyrNSS0+xOgDtH0is5Rocj4wovJK 4g2NTcyMLI3MjE3MjY1xCCuJ8zKeehIgJJCeWJKanZpakFoEM46Jg1OqgXEJl0vP8+7OyD9a K0K1Tl1+2RX/7XZFWBVzxbVsXeXspKkskx0muH1ViLpd8Ye/7c3vApZbf998zJ0e9zTI6dOG D/fOWU5VFwq5NSEm+uiViPhnrD2z51WqH625JJ2nfbr0aJTINMd7xlukz0W8Clq865SvzCdf O7PgYrODy++396jsm9LXVK3EUpyRaKjFXFScCAAS9h9ShwIAAA== X-CFilter-Loop: Reflected Cc: kyungmin.park@samsung.com, sw0312.kim@samsung.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org If edid of vidi from user is invalid, size calculated from a number of cea extensions can be wrong. So, validation should be checked. Signed-off-by: Seung-Woo Kim Signed-off-by: Kyungmin.park --- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index b192308..26d8261 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c @@ -558,11 +558,11 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data, } if (vidi->connection) { - if (!vidi->edid) { - DRM_DEBUG_KMS("edid data is null.\n"); + raw_edid = (struct edid *)(uint32_t)vidi->edid; + if (!drm_edid_is_valid(raw_edid)) { + DRM_DEBUG_KMS("edid data is invalid.\n"); return -EINVAL; } - raw_edid = (struct edid *)(uint32_t)vidi->edid; edid_len = (1 + raw_edid->extensions) * EDID_LENGTH; ctx->raw_edid = kzalloc(edid_len, GFP_KERNEL); if (!ctx->raw_edid) {