]> git.baikalelectronics.ru Git - kernel.git/commit
highmem: fix kmap_to_page() for kmap_local_page() addresses
authorIra Weiny <ira.weiny@intel.com>
Thu, 6 Oct 2022 04:05:55 +0000 (21:05 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 13 Oct 2022 01:51:51 +0000 (18:51 -0700)
commitb11ec9a6e133be1cfe98bf242042b18f4a0bfde2
tree57c08d46dad37f9879db3cedc124799973d36f38
parentb8c6b6841c5574a6753bb955ccb0b34263caac1d
highmem: fix kmap_to_page() for kmap_local_page() addresses

kmap_to_page() is used to get the page for a virtual address which may
be kmap'ed.  Unfortunately, kmap_local_page() stores mappings in a
thread local array separate from kmap().  These mappings were not
checked by the call.

Check the kmap_local_page() mappings and return the page if found.

Because it is intended to remove kmap_to_page() add a warn on once to
the kmap checks to flag potential issues early.

NOTE Due to 32bit x86 use of kmap local in iomap atmoic, KMAP_LOCAL does
not require HIGHMEM to be set.  Therefore the support calls required a
new KMAP_LOCAL section to fix 0day build errors.

[akpm@linux-foundation.org: fix warning]
Link: https://lkml.kernel.org/r/20221006040555.1502679-1-ira.weiny@intel.com
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Reported-by: kernel test robot <lkp@intel.com>
Cc: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/highmem.c