[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220118230539.323058-1-pcc@google.com>
Date: Tue, 18 Jan 2022 15:05:39 -0800
From: Peter Collingbourne <pcc@...gle.com>
To: Andrey Konovalov <andreyknvl@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Peter Collingbourne <pcc@...gle.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
Peter Zijlstra <peterz@...radead.org>,
Mel Gorman <mgorman@...e.de>, stable@...r.kernel.org
Subject: [PATCH] mm/mmzone.c: fix page_cpupid_xchg_last() to READ_ONCE() the
page flags
After submitting a patch with a compare-exchange loop similar to this
one to set the KASAN tag in the page flags, Andrey Konovalov pointed
out that we should be using READ_ONCE() to read the page flags. Fix
it here.
Fixes: 75980e97dacc ("mm: fold page->_last_nid into page->flags where possible")
Signed-off-by: Peter Collingbourne <pcc@...gle.com>
Link: https://linux-review.googlesource.com/id/I2e1f5b5b080ac9c4e0eb7f98768dba6fd7821693
Cc: stable@...r.kernel.org
---
mm/mmzone.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/mmzone.c b/mm/mmzone.c
index eb89d6e018e2..f84b84b0d3fc 100644
--- a/mm/mmzone.c
+++ b/mm/mmzone.c
@@ -90,7 +90,7 @@ int page_cpupid_xchg_last(struct page *page, int cpupid)
int last_cpupid;
do {
- old_flags = flags = page->flags;
+ old_flags = flags = READ_ONCE(page->flags);
last_cpupid = page_cpupid_last(page);
flags &= ~(LAST_CPUPID_MASK << LAST_CPUPID_PGSHIFT);
--
2.34.1.703.g22d0c6ccf7-goog
Powered by blists - more mailing lists