Skip to content

Commit a4bb3ec

Browse files
Naoya Horiguchitorvalds
authored andcommitted
mm/page-writeback: check-before-clear PageReclaim
With the page flag sanitization patchset, an invalid usage of ClearPageReclaim() is detected in set_page_dirty(). This can be called from __unmap_hugepage_range(), so let's check PageReclaim() before trying to clear it to avoid the misuse. Signed-off-by: Naoya Horiguchi <[email protected]> Acked-by: Kirill A. Shutemov <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent b3b3a99 commit a4bb3ec

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mm/page-writeback.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2228,7 +2228,8 @@ int set_page_dirty(struct page *page)
22282228
* it will confuse readahead and make it restart the size rampup
22292229
* process. But it's a trivial problem.
22302230
*/
2231-
ClearPageReclaim(page);
2231+
if (PageReclaim(page))
2232+
ClearPageReclaim(page);
22322233
#ifdef CONFIG_BLOCK
22332234
if (!spd)
22342235
spd = __set_page_dirty_buffers;

0 commit comments

Comments
 (0)