summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <[email protected]>2025-07-03 10:30:12 +0200
committerMarc Mutz <[email protected]>2025-07-03 22:21:04 +0200
commitb6faf63995b63d5958cf4b95ad1e9bab17d1bc6d (patch)
tree00813b0f1742fb402d5e49d04e055180c06e2d59
parent7dcd01d0f0cacde02bb7cb9686413ddd00fc76ca (diff)
QFreeList: fix UB (data race) in release()HEADdev
The load from _v[block] must acquire, to match the storeRelease() implied in the testAndSetRelease() in next(), where _v[block] was allocated. A loadReleaxed() will not establish the happens-before relation required to avoid a data race. So use loadAcquire(). Pick-to: 6.10 6.9 6.8 6.5 Change-Id: I34003ef7510a0d78f7851d2b4b4aab01a686babf Reviewed-by: Fabian Kosmale <[email protected]>
-rw-r--r--src/corelib/tools/qfreelist_p.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qfreelist_p.h b/src/corelib/tools/qfreelist_p.h
index 5c12332aa4a..cc12fb9c8d0 100644
--- a/src/corelib/tools/qfreelist_p.h
+++ b/src/corelib/tools/qfreelist_p.h
@@ -232,7 +232,7 @@ inline void QFreeList<T, ConstantsType>::release(int id)
{
int at = id & ConstantsType::IndexMask;
const int block = blockfor(at);
- ElementType *v = _v[block].loadRelaxed();
+ ElementType *v = _v[block].loadAcquire();
int x, newid;
do {