summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKonsta Holtta <kholtta@nvidia.com>2015-04-08 07:59:03 -0400
committerIshan Mittal <imittal@nvidia.com>2015-05-18 01:49:24 -0400
commitc19c04644616f6262d40f0d66e48dc50c856b24b (patch)
tree5524cb61f9fae9520d7dbe329cdfe5890e7786b1 /drivers
parentc90a897c8e3bf7563a93442604bd751d9c123e4e (diff)
gpu: nvgpu: protect missing sgt in gk20a_mem_phys
Return zero for missing sgt instead of attempting to dereference NULL. Those NULL conditions should be almost nonexistent, and zero is not normally used. When reading gk20a_mem_phys() in gk20a_gr_get_chid_from_ctx() from an isr, the mem desc may race with channel deletion and get suddendly zeroed, even if the channel's in_use flag would be set. Plain zero results in expected behaviour. Change-Id: Id8ce37798d6fd3ceeb96a3f521c82569fccf30aa Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-on: http://git-master/r/729006 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/nvgpu/gk20a/mm_gk20a.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h
index 57f7a373..0ff11d09 100644
--- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h
@@ -458,7 +458,9 @@ void gk20a_gmmu_free_attr(struct gk20a *g,
458 458
459static inline phys_addr_t gk20a_mem_phys(struct mem_desc *mem) 459static inline phys_addr_t gk20a_mem_phys(struct mem_desc *mem)
460{ 460{
461 return sg_phys(mem->sgt->sgl); 461 /* the sgt may get null if this is accessed e.g. in an isr during
462 * channel deletion */
463 return mem->sgt ? sg_phys(mem->sgt->sgl) : 0;
462} 464}
463 465
464u64 gk20a_locked_gmmu_map(struct vm_gk20a *vm, 466u64 gk20a_locked_gmmu_map(struct vm_gk20a *vm,