Skip to content

Commit

Permalink
powerpc/pseries/iommu: Use correct vfree for it_map
Browse files Browse the repository at this point in the history
The it_map array is vzalloc'ed so use vfree() for it when creating
a huge DMA window failed for whatever reason.

While at this, write zero to it_map.

Fixes: 381ceda ("powerpc/pseries/iommu: Make use of DDW for indirect mapping")
Signed-off-by: Alexey Kardashevskiy <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
aik authored and mpe committed Oct 25, 2021
1 parent 787252a commit 41ee723
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/powerpc/platforms/pseries/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1440,7 +1440,8 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn)
/* Keep default DMA window stuct if removed */
if (default_win_removed) {
tbl->it_size = 0;
kfree(tbl->it_map);
vfree(tbl->it_map);
tbl->it_map = NULL;
}

set_iommu_table_base(&dev->dev, newtbl);
Expand Down

0 comments on commit 41ee723

Please sign in to comment.