diff options
| author | Alex Deucher <[email protected]> | 2020-08-25 15:43:45 +0000 |
|---|---|---|
| committer | Alex Deucher <[email protected]> | 2020-08-26 19:45:51 +0000 |
| commit | b5b97cab55eb71daba3283c8b1d2cce456d511a1 (patch) | |
| tree | 84d8c39d26ada4d6cd32db4eaa58b4bee0b86ffa /drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | |
| parent | drm/amd/powerplay: Fix hardmins not being sent to SMU for RV (diff) | |
| download | kernel-b5b97cab55eb71daba3283c8b1d2cce456d511a1.tar.gz kernel-b5b97cab55eb71daba3283c8b1d2cce456d511a1.zip | |
drm/amdgpu: Fix buffer overflow in INFO ioctl
The values for "se_num" and "sh_num" come from the user in the ioctl.
They can be in the 0-255 range but if they're more than
AMDGPU_GFX_MAX_SE (4) or AMDGPU_GFX_MAX_SH_PER_SE (2) then it results in
an out of bounds read.
Reported-by: Dan Carpenter <[email protected]>
Acked-by: Dan Carpenter <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Cc: [email protected]
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index 0047da06041f..a1706b9f6467 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c @@ -678,8 +678,12 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file * in the bitfields */ if (se_num == AMDGPU_INFO_MMR_SE_INDEX_MASK) se_num = 0xffffffff; + else if (se_num >= AMDGPU_GFX_MAX_SE) + return -EINVAL; if (sh_num == AMDGPU_INFO_MMR_SH_INDEX_MASK) sh_num = 0xffffffff; + else if (sh_num >= AMDGPU_GFX_MAX_SH_PER_SE) + return -EINVAL; if (info->read_mmr_reg.count > 128) return -EINVAL; |
