From: Matthew Wilcox Date: Tue, 6 Nov 2018 18:11:57 +0000 (-0500) Subject: dax: Remove optimisation from dax_lock_mapping_entry X-Git-Tag: v5.15~7540^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6d7cd8c1373746a93dc868ee9d38a82df78b38aa;p=platform%2Fkernel%2Flinux-starfive.git dax: Remove optimisation from dax_lock_mapping_entry Skipping some of the revalidation after we sleep can lead to returning a mapping which has already been freed. Just drop this optimisation. Reported-by: Dan Williams Fixes: 9f32d221301c ("dax: Convert dax_lock_mapping_entry to XArray") Signed-off-by: Matthew Wilcox --- diff --git a/fs/dax.c b/fs/dax.c index 616e36e..529ac9d 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -383,11 +383,8 @@ bool dax_lock_mapping_entry(struct page *page) entry = xas_load(&xas); if (dax_is_locked(entry)) { entry = get_unlocked_entry(&xas); - /* Did the page move while we slept? */ - if (dax_to_pfn(entry) != page_to_pfn(page)) { - xas_unlock_irq(&xas); - continue; - } + xas_unlock_irq(&xas); + continue; } dax_lock_entry(&xas, entry); xas_unlock_irq(&xas);