From: Alex Williamson Subject: Re: [PATCH kernel] vfio/spapr_tce: Check kzalloc() return when preregistering memory Date: Tue, 11 Apr 2017 13:53:09 -0600 Message-ID: <20170411135300.134c6254@t450s.home> References: <20170327032340.18656-1-aik@ozlabs.ru> <20170327042457.GU19078@umbus.fritz.box> <982ff977-620a-e940-8d64-24bb213ea931@ozlabs.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: David Gibson , kvm@vger.kernel.org To: Alexey Kardashevskiy Return-path: Received: from mx1.redhat.com ([209.132.183.28]:50784 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752510AbdDKUc5 (ORCPT ); Tue, 11 Apr 2017 16:32:57 -0400 In-Reply-To: <982ff977-620a-e940-8d64-24bb213ea931@ozlabs.ru> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, 11 Apr 2017 18:27:49 +1000 Alexey Kardashevskiy wrote: > On 27/03/17 15:24, David Gibson wrote: > > 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 > > > > Reviewed-by: David Gibson > > > Alex? I've updated my next branch, I've got these from you: 3393af24b665 vfio/spapr_tce: Check kzalloc() return when preregistering memory 1282ba7fc28d vfio/powerpc/spapr_tce: Enforce IOMMU type compatibility check Am I missing anything else that needs to go through my tree for v4.12? Thanks, Alex > >> --- > >> 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); > >> > > > >