diff options
author | Alexey Kardashevskiy <aik@ozlabs.ru> | 2017-03-26 23:23:40 -0400 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2017-04-11 15:40:09 -0400 |
commit | 3393af24b665cb0aea7353b05e522b03ab1e7d73 (patch) | |
tree | 4cead9a9bc1979fa5e333fca7a9b6185b405ee0b | |
parent | 1282ba7fc28dbc66c3f0e4aaafaaa228361d1ae5 (diff) |
vfio/spapr_tce: Check kzalloc() return when preregistering memory
This adds missing checking for kzalloc() return value.
Fixes: 4b6fad7097f8 ("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>
-rw-r--r-- | drivers/vfio/vfio_iommu_spapr_tce.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c index a7d811524092..78dca1aa6410 100644 --- a/drivers/vfio/vfio_iommu_spapr_tce.c +++ b/drivers/vfio/vfio_iommu_spapr_tce.c | |||
@@ -198,6 +198,11 @@ static long tce_iommu_register_pages(struct tce_container *container, | |||
198 | return ret; | 198 | return ret; |
199 | 199 | ||
200 | tcemem = kzalloc(sizeof(*tcemem), GFP_KERNEL); | 200 | tcemem = kzalloc(sizeof(*tcemem), GFP_KERNEL); |
201 | if (!tcemem) { | ||
202 | mm_iommu_put(container->mm, mem); | ||
203 | return -ENOMEM; | ||
204 | } | ||
205 | |||
201 | tcemem->mem = mem; | 206 | tcemem->mem = mem; |
202 | list_add(&tcemem->next, &container->prereg_list); | 207 | list_add(&tcemem->next, &container->prereg_list); |
203 | 208 | ||