mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
drm/amdgpu: null check for hmm_pfns ptr before freeing it
Due to low memory or when num of pages is too big to be accomodated, allocation could fail for pfn's. Chekc hmm_pfns for NULL before calling the kvfree for the it. Signed-off-by: Sunil Khatri <sunil.khatri@amd.com> Acked-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
6f1ee58a5e
commit
84564d2920
@@ -286,7 +286,9 @@ void amdgpu_hmm_range_free(struct amdgpu_hmm_range *range)
|
||||
if (!range)
|
||||
return;
|
||||
|
||||
kvfree(range->hmm_range.hmm_pfns);
|
||||
if (range->hmm_range.hmm_pfns)
|
||||
kvfree(range->hmm_range.hmm_pfns);
|
||||
|
||||
amdgpu_bo_unref(&range->bo);
|
||||
kfree(range);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user