Skip to contentSkip to conversation

drm/exynos: added validation of edid for vidi connection

PATCH New Seung-Woo Kim 2 participants 2 messages Jan 10, 2013 – Jan 11, 2013

Subsystems (3)
lore
Share & tools
lore

Seung-Woo Kim

author maintainer
#0 lore raw

PATCH 1/1 drm/exynos: added validation of edid for vidi connection

If edid of vidi from user is invalid, size calculated from a number of cea extensions can be wrong. So, validation should be checked.

---
 drivers/gpu/drm/exynos/exynos_drm_vidi.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_vidi.c +3 -3
index b192308..26d8261 100644
@@ -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) {
Signature · 1 line
1.7.4.1
maintainer
#1 lore raw

PATCH 1/1 drm/exynos: added validation of edid for vidi connection

From: Seung-Woo Kim <[email protected]>

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.

---
 drivers/gpu/drm/exynos/exynos_drm_vidi.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_vidi.c +3 -4
index 046c5fe..ad74404 100644
@@ -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) {
Signature · 1 line
1.7.4.1