Skip to content

Commit 751688b

Browse files
sjp38akpm00
authored andcommitted
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/[email protected] Link: https://lkml.kernel.org/r/[email protected] Fixes: 397b0c3 ("mm/damon/paddr: remove folio_sz field from damon_pa_access_chk_result") Signed-off-by: SeongJae Park <[email protected]> Reviewed-by: Kefeng Wang <[email protected]> Reviewed-by: Matthew Wilcox (Oracle) <[email protected]> Cc: Vishal Moola (Oracle) <[email protected]> Cc: <[email protected]> [6.2.x] Signed-off-by: Andrew Morton <[email protected]>
1 parent 90410bc commit 751688b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

mm/damon/paddr.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ static bool damon_pa_young(unsigned long paddr, unsigned long *folio_sz)
130130
accessed = false;
131131
else
132132
accessed = true;
133-
folio_put(folio);
134133
goto out;
135134
}
136135

@@ -144,10 +143,10 @@ static bool damon_pa_young(unsigned long paddr, unsigned long *folio_sz)
144143

145144
if (need_lock)
146145
folio_unlock(folio);
147-
folio_put(folio);
148146

149147
out:
150148
*folio_sz = folio_size(folio);
149+
folio_put(folio);
151150
return accessed;
152151
}
153152

0 commit comments

Comments
 (0)