]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/book3s64: Fix error handling in mm_iommu_do_alloc()
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Mon, 23 Dec 2019 06:03:51 +0000 (17:03 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 4 Mar 2020 11:44:27 +0000 (22:44 +1100)
commitc4b78169e3667413184c9a20e11b5832288a109f
tree71c574f533e152ae83d7b0bd06729cea889d5eca
parentf344f0ab993987ae29cb39cc52054d7346db082f
powerpc/book3s64: Fix error handling in mm_iommu_do_alloc()

The last jump to free_exit in mm_iommu_do_alloc() happens after page
pointers in struct mm_iommu_table_group_mem_t were already converted to
physical addresses. Thus calling put_page() on these physical addresses
will likely crash.

This moves the loop which calculates the pageshift and converts page
struct pointers to physical addresses later after the point when
we cannot fail; thus eliminating the need to convert pointers back.

Fixes: eb9d7a62c386 ("powerpc/mm_iommu: Fix potential deadlock")
Reported-by: Jan Kara <jack@suse.cz>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20191223060351.26359-1-aik@ozlabs.ru
arch/powerpc/mm/book3s64/iommu_api.c