Re: [PATCH] s390/mm: Simplify crst_table_upgrade()
From: Vasily Gorbik
Date: Thu Aug 27 2026 - 12:00:12 EST
On Thu, Aug 27, 2026 at 12:28:32PM +0200, Heiko Carstens wrote:
> In case of an upgrade from four to five level page tables, and a failing
> pgd allocation, the exit path of crst_table_upgrade() would incorrectly
> dereference the p4d NULL pointer via pagetable_dtor().
>
> Address this by reworking crst_table_upgrade(), which basically is a
> revert of [1]. Take into account that GFP_KERNEL order-2 allocation
> failures are very unlikely. Therefore keep the code as simple as
> possible:
>
> In case of an upgrade from three to five levels, and an allocation
> failure of the fifth page table level, keep the upgrade to four levels
> instead of reverting back to three levels. This allows to keep error
> handling minimal.
>
> [1] commit 31932757c612 ("s390/mm: optimize page table upgrade routine")
>
> Reviewed-by: Alexander Gordeev <agordeev@xxxxxxxxxxxxx>
> Signed-off-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
> ---
> arch/s390/mm/pgalloc.c | 89 +++++++++++++++++-------------------------
> 1 file changed, 36 insertions(+), 53 deletions(-)
Applied, thank you!