Commit 3393af24 authored by Alexey Kardashevskiy's avatar Alexey Kardashevskiy Committed by Alex Williamson

vfio/spapr_tce: Check kzalloc() return when preregistering memory

This adds missing checking for kzalloc() return value.

Fixes: 4b6fad70 ("powerpc/mm/iommu, vfio/spapr: Put pages on VFIO container shutdown")
Signed-off-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent 1282ba7f
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment