mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
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>
This commit is contained in:
committed by
Ishan Mittal
parent
c90a897c8e
commit
c19c046446
@@ -458,7 +458,9 @@ void gk20a_gmmu_free_attr(struct gk20a *g,
|
||||
|
||||
static inline phys_addr_t gk20a_mem_phys(struct mem_desc *mem)
|
||||
{
|
||||
return sg_phys(mem->sgt->sgl);
|
||||
/* the sgt may get null if this is accessed e.g. in an isr during
|
||||
* channel deletion */
|
||||
return mem->sgt ? sg_phys(mem->sgt->sgl) : 0;
|
||||
}
|
||||
|
||||
u64 gk20a_locked_gmmu_map(struct vm_gk20a *vm,
|
||||
|
||||
Reference in New Issue
Block a user