OSDN Git Service

mm: Fix devm_memremap_pages() collision handling
authorJan H. Schönherr <jschoenh@amazon.de>
Fri, 23 Feb 2018 22:06:10 +0000 (14:06 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Feb 2018 09:18:34 +0000 (10:18 +0100)
commit8f7cf88d59f0026af8d4c9fe0a14a445ba499d93
tree8678ef04703f71d41b9f93832cf80c1f3b7d6418
parent807e3365895ca847749864c482d95c0ec1c89461
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/memremap.c