diff options
author | Shih-hsin Li <seasonl@nvidia.com> | 2019-05-07 19:34:01 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2019-05-09 23:43:17 -0400 |
commit | af95d14bb08850ed449eebae227faca800747108 (patch) | |
tree | e262ce10e0283d153f3527d7d375abaec22a4383 /drivers/gpu/nvgpu/common | |
parent | 6509bb49da19ba9b19e3df64e473b01d54fd310d (diff) |
gpu: nvgpu: fix synchronization in nvgpu_vm_map
The mapping early returned from nvgpu_vm_map might already
be unmapped during channel clean up. Increase refcount of
an already mapped buffer inside the scope of update_gmmu_lock
mutex to avoid this race.
Bug 200494150
Change-Id: I66d9272e42c40cd3aae7ba3bb8106ec37691bf8e
Signed-off-by: Shih-hsin Li <seasonl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2114163
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
Reviewed-by: Daniel Fu <danifu@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common')
-rw-r--r-- | drivers/gpu/nvgpu/common/mm/vm.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/common/mm/vm.c b/drivers/gpu/nvgpu/common/mm/vm.c index 7f0b3d10..4e221500 100644 --- a/drivers/gpu/nvgpu/common/mm/vm.c +++ b/drivers/gpu/nvgpu/common/mm/vm.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * Permission is hereby granted, free of charge, to any person obtaining a | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
5 | * copy of this software and associated documentation files (the "Software"), | 5 | * copy of this software and associated documentation files (the "Software"), |
@@ -873,12 +873,13 @@ struct nvgpu_mapped_buf *nvgpu_vm_map(struct vm_gk20a *vm, | |||
873 | map_addr, | 873 | map_addr, |
874 | flags, | 874 | flags, |
875 | map_key_kind); | 875 | map_key_kind); |
876 | nvgpu_mutex_release(&vm->update_gmmu_lock); | ||
877 | 876 | ||
878 | if (mapped_buffer) { | 877 | if (mapped_buffer) { |
879 | nvgpu_ref_get(&mapped_buffer->ref); | 878 | nvgpu_ref_get(&mapped_buffer->ref); |
879 | nvgpu_mutex_release(&vm->update_gmmu_lock); | ||
880 | return mapped_buffer; | 880 | return mapped_buffer; |
881 | } | 881 | } |
882 | nvgpu_mutex_release(&vm->update_gmmu_lock); | ||
882 | } | 883 | } |
883 | 884 | ||
884 | /* | 885 | /* |