From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95B072E6121; Tue, 8 Jul 2025 17:00:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751994010; cv=none; b=ZcsgHDkPl/wTb52TIFGflBfhYpo0bbJmCM7qaIFP+lUCeOmyfhQq5UEKz61V20dkOeIMrK93In2bgoPZQiPXB0J2n90qrqh3cFuDessjrIv+JJmHePAIeFI/mrDo/OiyajYIV1i8xajj6Rm7VKXrx2MoMvtzzAymXkfysmxG4Ew= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751994010; c=relaxed/simple; bh=lx5STRVxkGqL0hORyjCl5yYmBVhdCqJaYte9nf22L6k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YVa53bvGt70jy/3nvnZdnNvP5VlXbwIM3DRYDTjWrmLigCbmQUtPEikTyzFgh+yc+vovA/y3A6CzIwFGYYRKIQLb4BIvc2NvDO+5P8+YEWQ/pmo1fhyXHhdaLapzfM5yqZiRbH+vTLpn37JFb3N3kl5sniV3ZN4CCARFZ3F2QY8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=2SIBN0ny; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="2SIBN0ny" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1DD7DC4CEED; Tue, 8 Jul 2025 17:00:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1751994010; bh=lx5STRVxkGqL0hORyjCl5yYmBVhdCqJaYte9nf22L6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2SIBN0nyOBJz3ovZRneQd/VD9oINAyBkrHdla14cJrhdxA5jT1ilijASjtCC72lZX 8c/TWv/fLoWR2o/CIIQGjm6G6Comclu8qol26G3zWsxkxsQzQ+3Q5KhF1vgeFXbUFD XT0ElPjVS+6KxfOIDiH9gcaVejtRx4bOUsnTLFFk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ryan Roberts , David Hildenbrand , Dev Jain , Catalin Marinas , Anshuman Khandual , Will Deacon Subject: [PATCH 5.15 094/160] arm64: Restrict pagetable teardown to avoid false warning Date: Tue, 8 Jul 2025 18:22:11 +0200 Message-ID: <20250708162234.108663468@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250708162231.503362020@linuxfoundation.org> References: <20250708162231.503362020@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dev Jain commit 650768c512faba8070bf4cfbb28c95eb5cd203f3 upstream. Commit 9c006972c3fe ("arm64: mmu: drop pXd_present() checks from pXd_free_pYd_table()") removes the pxd_present() checks because the caller checks pxd_present(). But, in case of vmap_try_huge_pud(), the caller only checks pud_present(); pud_free_pmd_page() recurses on each pmd through pmd_free_pte_page(), wherein the pmd may be none. Thus it is possible to hit a warning in the latter, since pmd_none => !pmd_table(). Thus, add a pmd_present() check in pud_free_pmd_page(). This problem was found by code inspection. Fixes: 9c006972c3fe ("arm64: mmu: drop pXd_present() checks from pXd_free_pYd_table()") Cc: stable@vger.kernel.org Reported-by: Ryan Roberts Acked-by: David Hildenbrand Signed-off-by: Dev Jain Reviewed-by: Catalin Marinas Reviewed-by: Anshuman Khandual Reviewed-by: Ryan Roberts Link: https://lore.kernel.org/r/20250527082633.61073-1-dev.jain@arm.com Signed-off-by: Will Deacon Signed-off-by: Greg Kroah-Hartman --- arch/arm64/mm/mmu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -1466,7 +1466,8 @@ int pud_free_pmd_page(pud_t *pudp, unsig next = addr; end = addr + PUD_SIZE; do { - pmd_free_pte_page(pmdp, next); + if (pmd_present(READ_ONCE(*pmdp))) + pmd_free_pte_page(pmdp, next); } while (pmdp++, next += PMD_SIZE, next != end); pud_clear(pudp);