[PATCH 2/2 mmotm] mm/page-writeback: check-before-clear PageReclaim

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With 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
flag before trying to clear it to avoid the misuse.

Signed-off-by: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx>
---
 mm/page-writeback.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 22f3714d35e6..38aa0d8f19d3 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -2225,7 +2225,8 @@ int set_page_dirty(struct page *page)
 		 * it will confuse readahead and make it restart the size rampup
 		 * process. But it's a trivial problem.
 		 */
-		ClearPageReclaim(page);
+		if (PageReclaim(page))
+			ClearPageReclaim(page);
 #ifdef CONFIG_BLOCK
 		if (!spd)
 			spd = __set_page_dirty_buffers;
-- 
2.1.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]