Commit 751688b8 authored by SeongJae Park's avatar SeongJae Park Committed by Andrew Morton

mm/damon/paddr: fix folio_size() call after folio_put() in damon_pa_young()

Patch series "mm/damon/paddr: Fix folio-use-after-put bugs".

There are two folio accesses after folio_put() in mm/damon/paddr.c file. 
Fix those.


This patch (of 2):

damon_pa_young() is accessing a folio via folio_size() after folio_put()
for the folio has invoked.  Fix it.

Link: https://lkml.kernel.org/r/20230304193949.296391-1-sj@kernel.org
Link: https://lkml.kernel.org/r/20230304193949.296391-2-sj@kernel.org
Fixes: 397b0c3a ("mm/damon/paddr: remove folio_sz field from damon_pa_access_chk_result")
Signed-off-by: default avatarSeongJae Park <sj@kernel.org>
Reviewed-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Cc: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Cc: <stable@vger.kernel.org>	[6.2.x]
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 90410bcf
...@@ -130,7 +130,6 @@ static bool damon_pa_young(unsigned long paddr, unsigned long *folio_sz) ...@@ -130,7 +130,6 @@ static bool damon_pa_young(unsigned long paddr, unsigned long *folio_sz)
accessed = false; accessed = false;
else else
accessed = true; accessed = true;
folio_put(folio);
goto out; goto out;
} }
...@@ -144,10 +143,10 @@ static bool damon_pa_young(unsigned long paddr, unsigned long *folio_sz) ...@@ -144,10 +143,10 @@ static bool damon_pa_young(unsigned long paddr, unsigned long *folio_sz)
if (need_lock) if (need_lock)
folio_unlock(folio); folio_unlock(folio);
folio_put(folio);
out: out:
*folio_sz = folio_size(folio); *folio_sz = folio_size(folio);
folio_put(folio);
return accessed; return accessed;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment