drm/radeon: fix copy of uninitialized variable back to userspace
Subsystems (3)
PATCH 1/1 drm/radeon: fix copy of uninitialized variable back to userspace
From: Colin Ian King <[email protected]>
Currently the ioctl command RADEON_INFO_SI_BACKEND_ENABLED_MASK can copy back uninitialised data in value_tmp that pointer *value points to. This can occur when rdev->family is less than CHIP_BONAIRE and less than CHIP_TAHITI. Fix this by adding in a missing -EINVAL so that no invalid value is copied back to userspace.
Addresses-Coverity: ("Uninitialized scalar variable)
--- drivers/gpu/drm/radeon/radeon_kms.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/radeon/radeon_kms.c +1 -0
@@ -518,6 +518,7 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) *value = rdev->config.si.backend_enable_mask; }else {DRM_DEBUG_KMS ("BACKEND_ENABLED_MASK is si+ only!\n" ); +return -EINVAL ; }break ;case RADEON_INFO_MAX_SCLK :
Signature · 6 lines
2.30.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Am 03.03.21 um 01:27 schrieb Colin King:
Quoted 8 lines
From: Colin Ian King <[email protected]>
Currently the ioctl command
RADEON_INFO_SI_BACKEND_ENABLED_MASKcan copy back uninitialised data invalue_tmpthat pointer *value points to. This can occur whenrdev->familyis less thanCHIP_BONAIREand less thanCHIP_TAHITI. Fix this by adding in a missing-EINVALso that no invalid value is copied back to userspace.
Quoted 4 lines
Addresses-Coverity: ("Uninitialized scalar variable)
Cc [email protected] # 3.13+Fixes 439a1cfffe2c ("drm/radeon: expose render backend mask to the userspace")Signed-off-by Colin Ian King <[email protected]>
Let's hope that this doesn't break UAPI.
Christian.
Quoted 9 lines
--- drivers/gpu/drm/radeon/radeon_kms.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/radeon/radeon_kms.c +0
-0
drivers/gpu/drm/radeon/radeon_kms.c int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · line 524
Quoted 7 lines
drivers/gpu/drm/radeon/radeon_kms.c +1
-0@@ -518,6 +518,7 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) *value = rdev->config.si.backend_enable_mask; }else {DRM_DEBUG_KMS ("BACKEND_ENABLED_MASK is si+ only!\n" ); +return -EINVAL ; }break ;case RADEON_INFO_MAX_SCLK :
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
AppliedApplied. Thanks!
Alex
Quoted 34 lines · Christian König
Am 03.03.21 um 01:27 schrieb Colin King:
Quoted 8 lines
From: Colin Ian King <[email protected]>
Currently the ioctl command
RADEON_INFO_SI_BACKEND_ENABLED_MASKcan copy back uninitialised data invalue_tmpthat pointer *value points to. This can occur whenrdev->familyis less thanCHIP_BONAIREand less thanCHIP_TAHITI. Fix this by adding in a missing-EINVALso that no invalid value is copied back to userspace.Quoted 4 lines
Addresses-Coverity: ("Uninitialized scalar variable)
Cc [email protected] # 3.13+Fixes 439a1cfffe2c ("drm/radeon: expose render backend mask to the userspace")Signed-off-by Colin Ian King <[email protected]>Reviewed-by Christian König <[email protected]>Let's hope that this doesn't break UAPI.
Christian.
Quoted 13 lines
--- drivers/gpu/drm/radeon/radeon_kms.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/radeon/radeon_kms.c +1
-0@@ -518,6 +518,7 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) *value = rdev->config.si.backend_enable_mask; }else {DRM_DEBUG_KMS ("BACKEND_ENABLED_MASK is si+ only!\n" ); +return -EINVAL ;
Quoted 8 lines
drivers/gpu/drm/radeon/radeon_kms.c int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · line 524
Quoted 3 lines
drivers/gpu/drm/radeon/radeon_kms.c +0
-0}break ;case RADEON_INFO_MAX_SCLK :_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 9 lines · Christian König
Am 03.03.21 um 01:27 schrieb Colin King:
Quoted 8 lines
From: Colin Ian King <[email protected]>
Currently the ioctl command
RADEON_INFO_SI_BACKEND_ENABLED_MASKcan copy back uninitialised data invalue_tmpthat pointer *value points to. This can occur whenrdev->familyis less thanCHIP_BONAIREand less thanCHIP_TAHITI. Fix this by adding in a missing-EINVALso that no invalid value is copied back to userspace.
Quoted 8 lines
Quoted 4 lines
Addresses-Coverity: ("Uninitialized scalar variable)
Cc [email protected] # 3.13+Fixes 439a1cfffe2c ("drm/radeon: expose render backend mask to the userspace")Signed-off-by Colin Ian King <[email protected]>Reviewed-by Christian König <[email protected]>Let's hope that this doesn't break UAPI.
If it does I think the only difference would be errno userspace sees (aside from the stack garbage, which we could also emulate). Switching to return 0; is easy. So no worries this would be a problem :-) -Daniel
Quoted 20 lines
Christian.
Quoted 16 lines
--- drivers/gpu/drm/radeon/radeon_kms.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/radeon/radeon_kms.c +1
-0@@ -518,6 +518,7 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) *value = rdev->config.si.backend_enable_mask; }else {DRM_DEBUG_KMS ("BACKEND_ENABLED_MASK is si+ only!\n" ); +return -EINVAL ; }break ;case RADEON_INFO_MAX_SCLK :
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx