mm: Fix devm_memremap_pages() collision handling
authorJan H. Schönherr <jschoenh@amazon.de>
Sat, 20 Jan 2018 00:26:33 +0000 (16:26 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 15 Sep 2018 07:45:35 +0000 (09:45 +0200)
commit801fc191bb15655f7e694ba611ee02189f323291
tree903f603ef5ae14593c66db1566e90e135dc7474e
parent1508043c32a9dfe4af214eb712ab4b5b33158f27
mm: Fix devm_memremap_pages() collision handling

commit 77dd66a3c67c93ab401ccc15efff25578be281fd upstream.

If devm_memremap_pages() detects a collision while adding entries
to the radix-tree, we call pgmap_radix_release(). Unfortunately,
the function removes *all* entries for the range -- including the
entries that caused the collision in the first place.

Modify pgmap_radix_release() to take an additional argument to
indicate where to stop, so that only newly added entries are removed
from the tree.

Cc: <stable@vger.kernel.org>
Fixes: 9476df7d80df ("mm: introduce find_dev_pagemap()")
Signed-off-by: Jan H. Schönherr <jschoenh@amazon.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/memremap.c