Skip to contentSkip to conversation

drm/amd/amdgpu/amdgpu_uvd: Fix forgotten unmap buffer object

PATCH In review zhanglianjie 2 participants 4 messages Jan 29, 2022 – Feb 8, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/amd/amdgpu/amdgpu_uvd: Fix forgotten unmap buffer object

after the buffer object is successfully mapped, call amdgpu_bo_kunmap before the function returns.

drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +2 -0
index 6f8de11a17f1..9cc23b220537 100644
@@ -834,6 +834,7 @@ static int amdgpu_uvd_cs_msg(struct amdgpu_uvd_cs_ctx *ctx,
 	handle = msg[2];
 
 	if (handle == 0) {
+		amdgpu_bo_kunmap(bo);
 		DRM_ERROR("Invalid UVD handle!\n");
 		return -EINVAL;
 	}
@@ -892,6 +893,7 @@ static int amdgpu_uvd_cs_msg(struct amdgpu_uvd_cs_ctx *ctx,
 		DRM_ERROR("Illegal UVD message type (%d)!\n", msg_type);
 	}
 
+	amdgpu_bo_kunmap(bo);
 	return -EINVAL;
 }
 

--
2.20.1

#1 lore raw

PATCH 2/2 drm/radeon/uvd: Fix forgotten unmap buffer objects

after the buffer object is successfully mapped, call radeon_bo_kunmap before the function returns.

drivers/gpu/drm/radeon/radeon_uvd.c +2 -2
index 377f9cdb5b53..c5482f7793db 100644
@@ -497,6 +497,7 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo,
 	handle = msg[2];
 
 	if (handle == 0) {
+		radeon_bo_kunmap(bo);
 		DRM_ERROR("Invalid UVD handle!\n");
 		return -EINVAL;
 	}
@@ -559,11 +560,10 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo,
 		return 0;
 
 	default:
-
 		DRM_ERROR("Illegal UVD message type (%d)!\n", msg_type);
-		return -EINVAL;
 	}
 
+	radeon_bo_kunmap(bo);
 	BUG();
 	return -EINVAL;
 }

--
2.20.1

maintainer
#2 lore raw

Re: [PATCH 2/2] drm/radeon/uvd: Fix forgotten unmap buffer objects

Am 29.01.22 um 08:35 schrieb zhanglianjie:

Quoted 17 lines

after the buffer object is successfully mapped, call radeon_bo_kunmap before the function returns.

drivers/gpu/drm/radeon/radeon_uvd.c +1 -0
index 377f9cdb5b53..c5482f7793db 100644
@@ -497,6 +497,7 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo,
  	handle = msg[2];
 
  	if (handle == 0) {
+		radeon_bo_kunmap(bo);
  		DRM_ERROR("Invalid UVD handle!\n");
  		return -EINVAL;
  	}

drivers/gpu/drm/radeon/radeon_uvd.c static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo, · line 567

Quoted 10 lines
drivers/gpu/drm/radeon/radeon_uvd.c +1 -2
@@ -559,11 +560,10 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo,
  		return 0;
 
  	default:
-
  		DRM_ERROR("Illegal UVD message type (%d)!\n", msg_type);
-		return -EINVAL;
  	}
 
+	radeon_bo_kunmap(bo);
  	BUG();

That looks like it will trigger this BUG() now. Please also remove that line.

Apart from that the patches look good to me.

Regards,
Christian.

Quoted 7 lines
drivers/gpu/drm/radeon/radeon_uvd.c +0 -1
  	return -EINVAL;
  }
--

2.20.1

#3 lore raw

Re: [PATCH 2/2] drm/radeon/uvd: Fix forgotten unmap buffer objects

Hi,
Thanks for your review. I have resubmitted, see https://lkml.org/lkml/2022/2/7/2014

Quoted 49 lines

Am 29.01.22 um 08:35 schrieb zhanglianjie:

Quoted 27 lines

after the buffer object is successfully mapped, call radeon_bo_kunmap before the function returns.

drivers/gpu/drm/radeon/radeon_uvd.c +1 -0
index 377f9cdb5b53..c5482f7793db 100644
@@ -497,6 +497,7 @@ static int radeon_uvd_cs_msg(struct 
 radeon_cs_parser *p, struct radeon_bo *bo,
       handle = msg[2];
 
       if (handle == 0) {
+        radeon_bo_kunmap(bo);
           DRM_ERROR("Invalid UVD handle!\n");
           return -EINVAL;

      }

drivers/gpu/drm/radeon/radeon_uvd.c +0 -0
@@ -559,11 +560,10 @@ static int radeon_uvd_cs_msg(struct 
 radeon_cs_parser *p, struct radeon_bo *bo,
           return 0;
 

      default:
-
          DRM_ERROR("Illegal UVD message type (%d)!\n", msg_type); -        return -EINVAL;
      }

Quoted 2 lines

+    radeon_bo_kunmap(bo);
      BUG();

That looks like it will trigger this BUG() now. Please also remove that line.

Apart from that the patches look good to me.

Regards,
Christian.

Quoted 7 lines

      return -EINVAL;
  }

Signature · 1 line
2.20.1