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 491D33212 for ; Tue, 7 Feb 2023 13:13:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8929FC433EF; Tue, 7 Feb 2023 13:13:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1675775605; bh=GIt/NGRdB9Ze1hD+cI0d1rL9tfQedGhfG7ELb8u2HhU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qZP/Ts7jZwsby7aNVcPpGmiZX4i/gdYvKlpW2Qtmxh6glGgkkXkMNWPOGw7QQegxo l/YWmM2KV3KB0t/pIwKrZDnHP9Ygg83ofcs9mblDc1Ye8Zv/YAibfwxC3CRssKV9S8 YlnD0/p9jozoRoXgMayKiA/CZXsERSe7BNtngr9c= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Matthew Wilcox (Oracle)" , Ira Weiny , "Fabio M. De Francesco" , Al Viro , Thomas Gleixner , Helge Deller , Alexander Potapenko , Andrey Konovalov , Bagas Sanjaya , David Sterba , Kees Cook , Sebastian Andrzej Siewior , Tony Luck , Andrew Morton Subject: [PATCH 5.15 096/120] highmem: round down the address passed to kunmap_flush_on_unmap() Date: Tue, 7 Feb 2023 13:57:47 +0100 Message-Id: <20230207125622.861124760@linuxfoundation.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230207125618.699726054@linuxfoundation.org> References: <20230207125618.699726054@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Matthew Wilcox (Oracle) commit 88d7b12068b95731c280af8ce88e8ee9561f96de upstream. We already round down the address in kunmap_local_indexed() which is the other implementation of __kunmap_local(). The only implementation of kunmap_flush_on_unmap() is PA-RISC which is expecting a page-aligned address. This may be causing PA-RISC to be flushing the wrong addresses currently. Link: https://lkml.kernel.org/r/20230126200727.1680362-1-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) Fixes: 298fa1ad5571 ("highmem: Provide generic variant of kmap_atomic*") Reviewed-by: Ira Weiny Cc: "Fabio M. De Francesco" Cc: Al Viro Cc: Thomas Gleixner Cc: Helge Deller Cc: Alexander Potapenko Cc: Andrey Konovalov Cc: Bagas Sanjaya Cc: David Sterba Cc: Kees Cook Cc: Sebastian Andrzej Siewior Cc: Tony Luck Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- include/linux/highmem-internal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/include/linux/highmem-internal.h +++ b/include/linux/highmem-internal.h @@ -184,7 +184,7 @@ static inline void *kmap_local_pfn(unsig static inline void __kunmap_local(void *addr) { #ifdef ARCH_HAS_FLUSH_ON_KUNMAP - kunmap_flush_on_unmap(addr); + kunmap_flush_on_unmap(PTR_ALIGN_DOWN(addr, PAGE_SIZE)); #endif } @@ -211,7 +211,7 @@ static inline void *kmap_atomic_pfn(unsi static inline void __kunmap_atomic(void *addr) { #ifdef ARCH_HAS_FLUSH_ON_KUNMAP - kunmap_flush_on_unmap(addr); + kunmap_flush_on_unmap(PTR_ALIGN_DOWN(addr, PAGE_SIZE)); #endif pagefault_enable(); if (IS_ENABLED(CONFIG_PREEMPT_RT))