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 475584C74; Mon, 23 Jun 2025 22:02:00 +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=1750716120; cv=none; b=kJ2MnCniyTJW6eNCdF5PDqodg0J2wyikIhcZoEhzBF/l9ZaTvupdPayX62a+wWb8p+YbatKXaFGwK6OtdGCba2d4+nCiYsHHKxRFDGyT3j9lIsVTgpoEpNQAszHF8L1EluRJVNvm0Cxxe8dx6877kU2Fl69j933W3A3jE+xsunk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750716120; c=relaxed/simple; bh=3ARQAhjVCSmZv64TUkntB2QS8qZO8nCllVg7SXOrirA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l8UU+rUEFdtSeQApyo2lJ0b5rCJqN1zSl1rQWG+80D9S6SKB2q7ViCwtxyTJ5s+rE3UK8DeREYCkEaC4kXQrf5BRaO9W9Vo847oK5CbSE9Mylc1YxKdoM+6oWJsxC2BvA1K1hqOp8K2S7C3l+nPPRzx4aKupf1nXa1WVOGpXetc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=QnWza9gs; 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="QnWza9gs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4BC6C4CEEA; Mon, 23 Jun 2025 22:01:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750716120; bh=3ARQAhjVCSmZv64TUkntB2QS8qZO8nCllVg7SXOrirA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QnWza9gsiVDpBp5bT9C7ehfkNTWLYbRLPbghA83ROdV4xYPSq6Ms77A9IVbkgi2oW 79lLAJO3FEV3iKJaFFExfAjmD+ukD7wCWKDa7wMG9eAg0frRrrBOfuhbj/c4oDrWYs FSmxD+jrD9J22+LAwrx0IqzkOM4gV0hCgCuF66i8= 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 6.15 489/592] arm64: Restrict pagetable teardown to avoid false warning Date: Mon, 23 Jun 2025 15:07:27 +0200 Message-ID: <20250623130712.064925110@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250623130700.210182694@linuxfoundation.org> References: <20250623130700.210182694@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 6.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 @@ -1286,7 +1286,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(pmdp_get(pmdp))) + pmd_free_pte_page(pmdp, next); } while (pmdp++, next += PMD_SIZE, next != end); pud_clear(pudp);