From patchwork Fri Jan 11 04:20:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inki Dae X-Patchwork-Id: 1963571 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 13783DF2A2 for ; Fri, 11 Jan 2013 04:37:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A8CFCE678B for ; Thu, 10 Jan 2013 20:37:08 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by gabe.freedesktop.org (Postfix) with ESMTP id 39C23E6738 for ; Thu, 10 Jan 2013 20:33:54 -0800 (PST) Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MGG00BB91D9DTK0@mailout3.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 11 Jan 2013 13:20:29 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.42]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id EB.DC.12699.D039FE05; Fri, 11 Jan 2013 13:20:29 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-e0-50ef930d55ad Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 4B.DC.12699.D039FE05; Fri, 11 Jan 2013 13:20:29 +0900 (KST) Received: from daeinki-desktop.10.32.193.11 ([10.90.51.53]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MGG00BRO1E4F100@mmp1.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 11 Jan 2013 13:20:29 +0900 (KST) From: Inki Dae To: airlied@linux.ie, dri-devel@lists.freedesktop.org Subject: [PATCH] drm/exynos: added validation of edid for vidi connection Date: Fri, 11 Jan 2013 13:20:27 +0900 Message-id: <1357878027-5583-1-git-send-email-inki.dae@samsung.com> X-Mailer: git-send-email 1.7.4.1 In-reply-to: <1357814106-23131-1-git-send-email-sw0312.kim@samsung.com> References: <1357814106-23131-1-git-send-email-sw0312.kim@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrDLMWRmVeSWpSXmKPExsVy+t8zLV3eye8DDLZvFbe48vU9mwOjx/3u 40wBjFFcNimpOZllqUX6dglcGTvf/mcuaOCtuHZyFlMD43uuLkZODgkBE4mXC3vYIGwxiQv3 1oPZQgLLGCWW/CiCqek43MjaxcgFFF/EKLGn5xqUs55Jou/oHbAONgFViYkr7oPZIgKmEh2T lrKA2MwChRILe56C2cICnhKnm3cxgdgsQPVdXdNZQWxeAWeJ412t7BDbFCQW3HsLNodTwF3i 2fUFzBAXuUkcvzefBaJXQOLb5ENANgdQvazEpgPMIPdICFxmk9j9fhLUHEmJgytusExgFF7A yLCKUTS1ILmgOCk910ivODG3uDQvXS85P3cTIyQIpXcwrmqwOMQowMGoxMNbqfk+QIg1say4 MvcQowQHs5IIb00tUIg3JbGyKrUoP76oNCe1+BCjD9AlE5mlRJPzgRGSVxJvaGxgbGhoaWhm amlqgENYSZyX8dSTACGB9MSS1OzU1ILUIphxTBycUg2MSTuLFz5kn1Yy2/vKhjCt15/5iqMN bl//d+wsv8jKhvWpz5N4FH+z/4/y3fZvVpGTx/kDb477lc56Nt9KZ9aX4LAZjDdm7Hw3eysb o1WM1vR6obcLi0ULff1/nPyxY/bNw9l22momFfEndnOHLWC0eWkXdZHtmNEKCftZxYHZTNVT Q24fu3W4WomlOCPRUIu5qDgRACDdmxhvAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphkeLIzCtJLcpLzFFi42I5/e+xgC7v5PcBBh+O8Ftc+fqezYHR4373 caYAxqgGRpuM1MSU1CKF1Lzk/JTMvHRbJe/geOd4UzMDQ11DSwtzJYW8xNxUWyUXnwBdt8wc oLFKCmWJOaVAoYDE4mIlfTtME0JD3HQtYBojdH1DguB6jAzQQMI6xoydb/8zFzTwVlw7OYup gfE9VxcjJ4eEgIlEx+FGVghbTOLCvfVsXYxcHEICixgl9vRcY4Vw1jNJ9B29wwZSxSagKjFx xX0wW0TAVKJj0lIWEJtZoFBiYc9TMFtYwFPidPMuJhCbBai+q2s62AZeAWeJ412t7BDbFCQW 3HsLNodTwF3i2fUFzCC2kICbxPF781kmMPIuYGRYxSiaWpBcUJyUnmukV5yYW1yal66XnJ+7 iREc5M+kdzCuarA4xCjAwajEw1up+T5AiDWxrLgy9xCjBAezkghvTS1QiDclsbIqtSg/vqg0 J7X4EKMP0FUTmaVEk/OBEZhXEm9obGJmZGlkZmxibmyMQ1hJnJfx1JMAIYH0xJLU7NTUgtQi mHFMHJxSDYxpvxPEJgalH1lyYIVdfZaJ4EvetZVaSTkyPU/d6h+947p0bO+/dUv//F7guqZl w8sJO64GxBXu2XTtXJ2WWMYdkRvN2Uf/Sb96XC/co7qP/9MLab/3S+K2iHAE7TI418c0OeKL hWmykOjMW9kLqp42vxeedFDvn8M8uRC2VvdK9Ypl5xTkFV4rsRRnJBpqMRcVJwIA4Vq1PZ8C AAA= 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 From: Seung-Woo Kim If edid of vidi from user is invalid, size calculated from a number of cea extensions can be wrong. So, validation should be checked. Changelog v2: - just code cleanup . declare raw_edid only if vidi->connection is enabled. Signed-off-by: Seung-Woo Kim Signed-off-by: Kyungmin Park Signed-off-by: Inki Dae --- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 046c5fe..ad74404 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c @@ -529,7 +529,6 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data, struct exynos_drm_manager *manager; struct exynos_drm_display_ops *display_ops; struct drm_exynos_vidi_connection *vidi = data; - struct edid *raw_edid; int edid_len; DRM_DEBUG_KMS("%s\n", __FILE__); @@ -566,11 +565,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"); + struct edid *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) {