aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>2015-04-15 19:13:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-15 19:35:17 -0400
commita4bb3ecdc12a78dc4d0e690d40ec10887b640786 (patch)
tree84e0727cc1fec4c28f578d982d8ee511757aadbf
parentb3b3a99c5371e2e96a2c680e6ac20218bddbd422 (diff)
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 <n-horiguchi@ah.jp.nec.com> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/page-writeback.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 0372411f38fc..5daf5568b9e1 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -2228,7 +2228,8 @@ int set_page_dirty(struct page *page)
2228 * it will confuse readahead and make it restart the size rampup 2228 * it will confuse readahead and make it restart the size rampup
2229 * process. But it's a trivial problem. 2229 * process. But it's a trivial problem.
2230 */ 2230 */
2231 ClearPageReclaim(page); 2231 if (PageReclaim(page))
2232 ClearPageReclaim(page);
2232#ifdef CONFIG_BLOCK 2233#ifdef CONFIG_BLOCK
2233 if (!spd) 2234 if (!spd)
2234 spd = __set_page_dirty_buffers; 2235 spd = __set_page_dirty_buffers;