vfio/spapr_tce: Check kzalloc() return when preregistering memory
This adds missing checking for kzalloc() return value.
Fixes: 4b6fad7097
("powerpc/mm/iommu, vfio/spapr: Put pages on VFIO container shutdown")
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
This commit is contained in:
parent
1282ba7fc2
commit
3393af24b6
|
@ -198,6 +198,11 @@ static long tce_iommu_register_pages(struct tce_container *container,
|
|||
return ret;
|
||||
|
||||
tcemem = kzalloc(sizeof(*tcemem), GFP_KERNEL);
|
||||
if (!tcemem) {
|
||||
mm_iommu_put(container->mm, mem);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
tcemem->mem = mem;
|
||||
list_add(&tcemem->next, &container->prereg_list);
|
||||
|
||||
|
|
Loading…
Reference in New Issue