libhsakmt: Fix segfault on gfx801

Handle the case that svm.dgpu_aperture does not exist in vm_find_object.

Change-Id: Ic0983d4f321f1b6248514f2fa25162976e90bd75
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Этот коммит содержится в:
Felix Kuehling
2018-09-07 17:21:37 -04:00
родитель 1fda429726
Коммит be574169c1
+8 -2
Просмотреть файл
@@ -1033,6 +1033,9 @@ static vm_object_t *vm_find_object(const void *addr, uint64_t size,
}
if (!aper) {
if (!svm.dgpu_aperture)
goto no_svm;
if ((addr >= svm.dgpu_aperture->base) &&
(addr <= svm.dgpu_aperture->limit))
aper = svm.dgpu_aperture;
@@ -1075,9 +1078,11 @@ static vm_object_t *vm_find_object(const void *addr, uint64_t size,
}
}
no_svm:
if (!obj && !is_dgpu) {
/* On APUs try finding it in the CPUVM aperture */
pthread_mutex_unlock(&aper->fmm_mutex);
if (aper)
pthread_mutex_unlock(&aper->fmm_mutex);
aper = &cpuvm_aperture;
@@ -1093,7 +1098,8 @@ static vm_object_t *vm_find_object(const void *addr, uint64_t size,
return obj;
}
pthread_mutex_unlock(&aper->fmm_mutex);
if (aper)
pthread_mutex_unlock(&aper->fmm_mutex);
return NULL;
}