drm/amdgpu: don't clamp debugfs register access to the BAR size

Submitted by Mario Kleiner via amd-gfx on Feb. 11, 2019, 9:52 p.m.

Details

Message ID 20190211215221.31597-1-alexander.deucher@amd.com
State Accepted
Commit 7a5e0d9ab6d9564f5f82d7a16355118aadd25ef8
Headers show
Series "drm/amdgpu: don't clamp debugfs register access to the BAR size" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Mario Kleiner via amd-gfx Feb. 11, 2019, 9:52 p.m.
This prevents us from accessing extended registers in tools like
umr.  The register access functions already check if the offset
is beyond the BAR size and use the indirect accessors with locking
so this is safe.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 ---
 1 file changed, 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index dd9a4fb9ce39..4ae3ff9a1d4c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -158,9 +158,6 @@  static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
 	while (size) {
 		uint32_t value;
 
-		if (*pos > adev->rmmio_size)
-			goto end;
-
 		if (read) {
 			value = RREG32(*pos >> 2);
 			r = put_user(value, (uint32_t *)buf);

Comments

Am 11.02.19 um 22:52 schrieb Alex Deucher via amd-gfx:
> This prevents us from accessing extended registers in tools like
> umr.  The register access functions already check if the offset
> is beyond the BAR size and use the indirect accessors with locking
> so this is safe.
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

Reviewed-by: Christian K├Ânig <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 ---
>   1 file changed, 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> index dd9a4fb9ce39..4ae3ff9a1d4c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> @@ -158,9 +158,6 @@ static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
>   	while (size) {
>   		uint32_t value;
>   
> -		if (*pos > adev->rmmio_size)
> -			goto end;
> -
>   		if (read) {
>   			value = RREG32(*pos >> 2);
>   			r = put_user(value, (uint32_t *)buf);