]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
mm/highmem.c: fix zero_user_segments() with start > end
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Sat, 13 Mar 2021 05:07:37 +0000 (21:07 -0800)
committerSeth Forshee <seth.forshee@canonical.com>
Wed, 17 Mar 2021 18:49:05 +0000 (13:49 -0500)
commit221900a540b8c1f292c1a38d974addd8ad9c9b6e
tree0b76f8b5d83f10145b18f13e5b57a51ca7b94bce
parent70d3b2195eb33eb70b7f17904f175f7b98d4f8a4
mm/highmem.c: fix zero_user_segments() with start > end

BugLink: https://bugs.launchpad.net/bugs/1919492
commit 184cee516f3e24019a08ac8eb5c7cf04c00933cb upstream.

zero_user_segments() is used from __block_write_begin_int(), for example
like the following

zero_user_segments(page, 4096, 1024, 512, 918)

But new the zero_user_segments() implementation for for HIGHMEM +
TRANSPARENT_HUGEPAGE doesn't handle "start > end" case correctly, and hits
BUG_ON().  (we can fix __block_write_begin_int() instead though, it is the
old and multiple usage)

Also it calls kmap_atomic() unnecessarily while start == end == 0.

Link: https://lkml.kernel.org/r/87v9ab60r4.fsf@mail.parknet.co.jp
Fixes: 0060ef3b4e6d ("mm: support THPs in zero_user_segments")
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
mm/highmem.c