diff mbox

drm/radeon: fix UVD message buffer validation

Message ID 1376249276-2920-1-git-send-email-deathsimple@vodafone.de (mailing list archive)
State New, archived
Headers show

Commit Message

Christian König Aug. 11, 2013, 7:27 p.m. UTC
From: Christian König <christian.koenig@amd.com>

When the message buffer is currently moving block until it is idle again.

Signed-off-by: Christian König <christian.koenig@amd.com>
Cc: stable@vger.kernel.org
---
 drivers/gpu/drm/radeon/radeon_uvd.c |    8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Alex Deucher Aug. 12, 2013, 2:46 p.m. UTC | #1
On Sun, Aug 11, 2013 at 3:27 PM, Christian König
<deathsimple@vodafone.de> wrote:
> From: Christian König <christian.koenig@amd.com>
>
> When the message buffer is currently moving block until it is idle again.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> Cc: stable@vger.kernel.org

Applied to my fixes tree.

Alex

> ---
>  drivers/gpu/drm/radeon/radeon_uvd.c |    8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c
> index f1c1575..b79f4f5 100644
> --- a/drivers/gpu/drm/radeon/radeon_uvd.c
> +++ b/drivers/gpu/drm/radeon/radeon_uvd.c
> @@ -356,6 +356,14 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo,
>                 return -EINVAL;
>         }
>
> +       if (bo->tbo.sync_obj) {
> +               r = radeon_fence_wait(bo->tbo.sync_obj, false);
> +               if (r) {
> +                       DRM_ERROR("Failed waiting for UVD message (%d)!\n", r);
> +                       return r;
> +               }
> +       }
> +
>         r = radeon_bo_kmap(bo, &ptr);
>         if (r) {
>                 DRM_ERROR("Failed mapping the UVD message (%d)!\n", r);
> --
> 1.7.9.5
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c
index f1c1575..b79f4f5 100644
--- a/drivers/gpu/drm/radeon/radeon_uvd.c
+++ b/drivers/gpu/drm/radeon/radeon_uvd.c
@@ -356,6 +356,14 @@  static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo,
 		return -EINVAL;
 	}
 
+	if (bo->tbo.sync_obj) {
+		r = radeon_fence_wait(bo->tbo.sync_obj, false);
+		if (r) {
+			DRM_ERROR("Failed waiting for UVD message (%d)!\n", r);
+			return r;
+		}
+	}
+
 	r = radeon_bo_kmap(bo, &ptr);
 	if (r) {
 		DRM_ERROR("Failed mapping the UVD message (%d)!\n", r);