diff options
author | Seung-Woo Kim <sw0312.kim@samsung.com> | 2013-01-10 05:35:06 -0500 |
---|---|---|
committer | Inki Dae <inki.dae@samsung.com> | 2013-01-25 00:38:43 -0500 |
commit | e7808df1af8801cf4f2ac16be25db1b079b5da4c (patch) | |
tree | 3f3e9c62c33410b65ad0b3e65e107e612a453063 | |
parent | 9c08e4ba81a73862e15b3eb4e6ae2e11aaf4151b (diff) |
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.
Changelog v2:
- just code cleanup
. declare raw_edid only if vidi->connection is enabled.
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
-rw-r--r-- | 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 6d91000c56f9..13ccbd4bcfaa 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c | |||
@@ -521,7 +521,6 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data, | |||
521 | struct exynos_drm_manager *manager; | 521 | struct exynos_drm_manager *manager; |
522 | struct exynos_drm_display_ops *display_ops; | 522 | struct exynos_drm_display_ops *display_ops; |
523 | struct drm_exynos_vidi_connection *vidi = data; | 523 | struct drm_exynos_vidi_connection *vidi = data; |
524 | struct edid *raw_edid; | ||
525 | int edid_len; | 524 | int edid_len; |
526 | 525 | ||
527 | DRM_DEBUG_KMS("%s\n", __FILE__); | 526 | DRM_DEBUG_KMS("%s\n", __FILE__); |
@@ -558,11 +557,11 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data, | |||
558 | } | 557 | } |
559 | 558 | ||
560 | if (vidi->connection) { | 559 | if (vidi->connection) { |
561 | if (!vidi->edid) { | 560 | struct edid *raw_edid = (struct edid *)(uint32_t)vidi->edid; |
562 | DRM_DEBUG_KMS("edid data is null.\n"); | 561 | if (!drm_edid_is_valid(raw_edid)) { |
562 | DRM_DEBUG_KMS("edid data is invalid.\n"); | ||
563 | return -EINVAL; | 563 | return -EINVAL; |
564 | } | 564 | } |
565 | raw_edid = (struct edid *)(uint32_t)vidi->edid; | ||
566 | edid_len = (1 + raw_edid->extensions) * EDID_LENGTH; | 565 | edid_len = (1 + raw_edid->extensions) * EDID_LENGTH; |
567 | ctx->raw_edid = kzalloc(edid_len, GFP_KERNEL); | 566 | ctx->raw_edid = kzalloc(edid_len, GFP_KERNEL); |
568 | if (!ctx->raw_edid) { | 567 | if (!ctx->raw_edid) { |