mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
xen/arm: cmpxchg: Add missing memory barriers in __cmpxchg_mb_timeout()
The function __cmpxchg_mb_timeout() was intended to have the same semantics as __cmpxchg_mb(). Unfortunately, the memory barriers were not added when first implemented. There is no known issue with the existing callers, but the barriers are added given this is the expected semantics in Xen. The issue was introduced by XSA-295. Backport: 4.8+ Fixes:86b0bc9583("xen/arm: cmpxchg: Provide a new helper that can timeout") Signed-off-by: Julien Grall <jgrall@amazon.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com> (cherry picked from commitd501ef90ae)
This commit is contained in:
1 parent
174be04403
commit
28855ebcdb
2 files changed
+14
-2
No files matched your search
@@ -147,7 +147,13 @@ static always_inline bool __cmpxchg_mb_timeout(volatile void *ptr,
|
||||
int size,
|
||||
unsigned int max_try)
|
||||
{
|
||||
return __int_cmpxchg(ptr, old, new, size, true, max_try);
|
||||
bool ret;
|
||||
|
||||
smp_mb();
|
||||
ret = __int_cmpxchg(ptr, old, new, size, true, max_try);
|
||||
smp_mb();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define cmpxchg(ptr,o,n) \
|
||||
|
||||
@@ -160,7 +160,13 @@ static always_inline bool __cmpxchg_mb_timeout(volatile void *ptr,
|
||||
int size,
|
||||
unsigned int max_try)
|
||||
{
|
||||
return __int_cmpxchg(ptr, old, new, size, true, max_try);
|
||||
bool ret;
|
||||
|
||||
smp_mb();
|
||||
ret = __int_cmpxchg(ptr, old, new, size, true, max_try);
|
||||
smp_mb();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define cmpxchg(ptr, o, n) \
|
||||
|
||||