fs/ext2: Avoid page_address on pages returned by ext2_get_page
authorJavier Pello <javier.pello@urjc.es>
Wed, 14 Jul 2021 16:54:48 +0000 (18:54 +0200)
committerJan Kara <jack@suse.cz>
Fri, 16 Jul 2021 10:36:51 +0000 (12:36 +0200)
commit728d392f8a799f037812d0f2b254fb3b5e115fcf
treef7786885c6af432e6314b24afde73f34a8705663
parent2acf15b94d5b8ea8392c4b6753a6ffac3135cd78
fs/ext2: Avoid page_address on pages returned by ext2_get_page

Commit 782b76d7abdf02b12c46ed6f1e9bf715569027f7 ("fs/ext2: Replace
kmap() with kmap_local_page()") replaced the kmap/kunmap calls in
ext2_get_page/ext2_put_page with kmap_local_page/kunmap_local for
efficiency reasons. As a necessary side change, the commit also
made ext2_get_page (and ext2_find_entry and ext2_dotdot) return
the mapping address along with the page itself, as it is required
for kunmap_local, and converted uses of page_address on such pages
to use the newly returned address instead. However, uses of
page_address on such pages were missed in ext2_check_page and
ext2_delete_entry, which triggers oopses if kmap_local_page happens
to return an address from high memory. Fix this now by converting
the remaining uses of page_address to use the right address, as
returned by kmap_local_page.

Link: https://lore.kernel.org/r/20210714185448.8707ac239e9f12b3a7f5b9f9@urjc.es
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Javier Pello <javier.pello@urjc.es>
Fixes: 782b76d7abdf ("fs/ext2: Replace kmap() with kmap_local_page()")
Signed-off-by: Jan Kara <jack@suse.cz>
fs/ext2/dir.c
fs/ext2/ext2.h
fs/ext2/namei.c