vfio/spapr_tce: Check kzalloc() return when preregistering memory
Subsystems (3)
PATCH 1/1 vfio/spapr_tce: Check kzalloc() return when preregistering memory
This adds missing checking for kzalloc() return value.
--- drivers/vfio/vfio_iommu_spapr_tce.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/vfio/vfio_iommu_spapr_tce.c +5 -0
@@ -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);
Signature · 1 line
2.11.0
Quoted 4 lines · Alexey Kardashevskiy
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 <[email protected]>
Quoted 20 lines
--- drivers/vfio/vfio_iommu_spapr_tce.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/vfio/vfio_iommu_spapr_tce.c +5
-0@@ -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);
Signature · 4 lines
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
Quoted 7 lines · David Gibson
Quoted 4 lines · Alexey Kardashevskiy
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 <[email protected]>Reviewed-by David Gibson <[email protected]>
Alex?
Quoted 22 lines
Quoted 21 lines
--- drivers/vfio/vfio_iommu_spapr_tce.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/vfio/vfio_iommu_spapr_tce.c +5
-0@@ -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);
Signature · 1 line
Alexey
Quoted 11 lines · On Tue, 11 Apr 2017 18:27:49 +1000 Alexey Kardashevskiy <[email protected]> wrote:
Quoted 7 lines · David Gibson
Quoted 4 lines · Alexey Kardashevskiy
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 <[email protected]>Reviewed-by David Gibson <[email protected]>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
Quoted 23 lines
Quoted 21 lines
Quoted 20 lines
--- drivers/vfio/vfio_iommu_spapr_tce.c | 5 +++++ 1 file changed, 5 insertions(+)(quoted diff) +0
-0
b/drivers/vfio/vfio_iommu_spapr_tce.cindexcf3de91fbfe7..c298bb36e27a100644 ---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(structtce_container*container, return ret;drivers/vfio/vfio_iommu_spapr_tce.c +5
-0tcemem =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);
Quoted 13 lines · Alex Williamson
Quoted 10 lines · On Tue, 11 Apr 2017 18:27:49 +1000 Alexey Kardashevskiy <[email protected]> wrote:
Quoted 7 lines · David Gibson
Quoted 4 lines · Alexey Kardashevskiy
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 <[email protected]>Reviewed-by David Gibson <[email protected]>
Quoted 8 lines
Quoted 1 line
Alex?
I've updated my next branch, I've got these from you:
3393af24b665vfio/spapr_tce: Checkkzalloc()return when preregistering memory1282ba7fc28dvfio/powerpc/spapr_tce: Enforce IOMMU type compatibility checkAm I missing anything else that needs to go through my tree for v4.12?
No, this is all I wanted, thanks. I just did not see in any of your trees but I see it now.
Quoted 28 lines
Thanks,
Alex
Quoted 23 lines
Quoted 21 lines
Quoted 20 lines
--- drivers/vfio/vfio_iommu_spapr_tce.c | 5 +++++ 1 file changed, 5 insertions(+)(quoted diff) +0
-0
b/drivers/vfio/vfio_iommu_spapr_tce.cindexcf3de91fbfe7..c298bb36e27a100644 ---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(structtce_container*container, return ret;drivers/vfio/vfio_iommu_spapr_tce.c +5
-0tcemem =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);
Signature · 1 line
Alexey