Skip to content

Commit 88d7b12

Browse files
Matthew Wilcox (Oracle)akpm00
authored andcommitted
highmem: round down the address passed to kunmap_flush_on_unmap()
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) <willy@infradead.org> Fixes: 298fa1a ("highmem: Provide generic variant of kmap_atomic*") Reviewed-by: Ira Weiny <ira.weiny@intel.com> Cc: "Fabio M. De Francesco" <fmdefrancesco@gmail.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Helge Deller <deller@gmx.de> Cc: Alexander Potapenko <glider@google.com> Cc: Andrey Konovalov <andreyknvl@gmail.com> Cc: Bagas Sanjaya <bagasdotme@gmail.com> Cc: David Sterba <dsterba@suse.com> Cc: Kees Cook <keescook@chromium.org> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: Tony Luck <tony.luck@intel.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 73bdf65 commit 88d7b12

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

include/linux/highmem-internal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ static inline void *kmap_local_pfn(unsigned long pfn)
200200
static inline void __kunmap_local(const void *addr)
201201
{
202202
#ifdef ARCH_HAS_FLUSH_ON_KUNMAP
203-
kunmap_flush_on_unmap(addr);
203+
kunmap_flush_on_unmap(PTR_ALIGN_DOWN(addr, PAGE_SIZE));
204204
#endif
205205
}
206206

@@ -227,7 +227,7 @@ static inline void *kmap_atomic_pfn(unsigned long pfn)
227227
static inline void __kunmap_atomic(const void *addr)
228228
{
229229
#ifdef ARCH_HAS_FLUSH_ON_KUNMAP
230-
kunmap_flush_on_unmap(addr);
230+
kunmap_flush_on_unmap(PTR_ALIGN_DOWN(addr, PAGE_SIZE));
231231
#endif
232232
pagefault_enable();
233233
if (IS_ENABLED(CONFIG_PREEMPT_RT))

0 commit comments

Comments
 (0)