diff options
author | Jerry Zuo | 2017-07-31 23:10:44 +0200 |
---|---|---|
committer | Alex Deucher | 2017-09-27 00:16:36 +0200 |
commit | e8cd26434df0cd8d97f31aeb4399afcdc37fcfda (patch) | |
tree | 26614c3e36f8cb14e10d34a5431c4dcf2efe820f /drivers/gpu/drm/amd/display/dc/core/dc_resource.c | |
parent | drm/amd/display: fix gamma distortion on Vega (diff) | |
download | kernel-qcow2-linux-e8cd26434df0cd8d97f31aeb4399afcdc37fcfda.tar.gz kernel-qcow2-linux-e8cd26434df0cd8d97f31aeb4399afcdc37fcfda.tar.xz kernel-qcow2-linux-e8cd26434df0cd8d97f31aeb4399afcdc37fcfda.zip |
drm/amd/display: Use atomic types for ref_count
Current ref_count inc/dec is not guarded by locks which leads to
a raced condition where two threads try to access the variable
at the same time. In this case, both might act on the same cached
value and inc/dec from the same value, rather than inc/dec by 2.
Signed-off-by: Jerry Zuo <Jerry.Zuo@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display/dc/core/dc_resource.c')
-rw-r--r-- | drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c index 56a85c80131d..1d69bd25e07b 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c @@ -2238,7 +2238,7 @@ void dc_resource_validate_ctx_copy_construct( struct validate_context *dst_ctx) { int i, j; - int ref_count = dst_ctx->ref_count; + atomic_t ref_count = dst_ctx->ref_count; *dst_ctx = *src_ctx; |