libhsakmt: Prevent hsaKmtRegisterMemory* from registering non-userptr
hsaKmtRegisterMemory* can only register OS allocated userptr. v2: Apply changes to all hsaKmtRegisterMemory* stuff.(Philip) v3: Unlock aperture->fmm_mutex to aviod deadlock. Suggested-by: Felix Kuehling <Felix.Kuehling@amd.com> Change-Id: I1045af7edb4da8206cb878f64c0176ba4fc59f60 Signed-off-by: Lang Yu <Lang.Yu@amd.com> Signed-off-by: Chris Freehill <cfreehil@amd.com>
This commit is contained in:
@@ -3533,6 +3533,10 @@ HSAKMT_STATUS fmm_register_memory(void *address, uint64_t size_in_bytes,
|
||||
} else if (object->userptr) {
|
||||
/* Update an existing userptr */
|
||||
++object->registration_count;
|
||||
} else {
|
||||
/* Not a userptr when we are expecting one */
|
||||
pthread_mutex_unlock(&aperture->fmm_mutex);
|
||||
return HSAKMT_STATUS_INVALID_HANDLE;
|
||||
}
|
||||
/* Successful vm_find_object returns with aperture locked */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user