On Mon, Mar 27, 2017 at 02:23:40PM +1100, Alexey Kardashevskiy wrote: > 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@xxxxxxxxx> Reviewed-by: David Gibson <david@xxxxxxxxxxxxxxxxxxxxx> > --- > drivers/vfio/vfio_iommu_spapr_tce.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c > index cf3de91fbfe7..c298bb36e27a 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, > 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); > -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Attachment:
signature.asc
Description: PGP signature