gpu: nvgpu: fix nvgpu_locate_pte for unmapped entries

nvgpu_locate_pte() can be attempted on an address that is not mapped
yet. When the address is just right, it's possible that the pd entries
haven't been allocated yet; return an error in such case before
accessing the indexed entry.

Bug 200778663

Change-Id: I4f062531d30aec746d6828c2d05c046bc912bd2a
Signed-off-by: Konsta Hölttä <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2606175
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Konsta Hölttä
2021-10-05 13:37:27 +03:00
committed by mobile promotions
parent 4c93cca451
commit 189ab6bd9a

View File

@@ -1270,7 +1270,14 @@ static int nvgpu_locate_pte(struct gk20a *g, struct vm_gk20a *vm,
* then find the next level PD and recurse. * then find the next level PD and recurse.
*/ */
if (next_l->update_entry != NULL) { if (next_l->update_entry != NULL) {
struct nvgpu_gmmu_pd *pd_next = pd->entries + pd_idx; struct nvgpu_gmmu_pd *pd_next;
/* Not mapped yet, invalid entry */
if (pd->entries == NULL) {
return -EINVAL;
}
pd_next = pd->entries + pd_idx;
/* Invalid entry! */ /* Invalid entry! */
if (pd_next->mem == NULL) { if (pd_next->mem == NULL) {