[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-199e23780a7e75c63a9e3d1108804e3af450ea3e@git.kernel.org>
Date: Fri, 3 Jul 2009 12:44:06 GMT
From: tip-bot for Ingo Molnar <mingo@...e.hu>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, acme@...hat.com, paulus@...ba.org,
hpa@...or.com, mingo@...hat.com, eric.dumazet@...il.com,
a.p.zijlstra@...llo.nl, torvalds@...ux-foundation.org,
efault@....de, arnd@...db.de, dhowells@...hat.com,
fweisbec@...il.com, akpm@...ux-foundation.org, tglx@...utronix.de,
mingo@...e.hu
Subject: [tip:perfcounters/urgent] x86: atomic64: Fix unclean type use in atomic64_xchg()
Commit-ID: 199e23780a7e75c63a9e3d1108804e3af450ea3e
Gitweb: http://git.kernel.org/tip/199e23780a7e75c63a9e3d1108804e3af450ea3e
Author: Ingo Molnar <mingo@...e.hu>
AuthorDate: Fri, 3 Jul 2009 13:02:39 +0200
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Fri, 3 Jul 2009 13:26:46 +0200
x86: atomic64: Fix unclean type use in atomic64_xchg()
Linus noticed that atomic64_xchg() uses atomic_read(), which
happens to work because atomic_read() is a macro so the
.counter value gets u64-read on 32-bit too - but this is really
bogus and serious bugs are waiting to happen.
Fix atomic64_xchg() to use __atomic64_read() instead.
No code changed:
arch/x86/lib/atomic64_32.o:
text data bss dec hex filename
435 0 0 435 1b3 atomic64_32.o.before
435 0 0 435 1b3 atomic64_32.o.after
md5:
bd8ab95e69c93518578bfaf0ea3be4d9 atomic64_32.o.before.asm
bd8ab95e69c93518578bfaf0ea3be4d9 atomic64_32.o.after.asm
Reported-by: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Eric Dumazet <eric.dumazet@...il.com>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Mike Galbraith <efault@....de>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: David Howells <dhowells@...hat.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Arnd Bergmann <arnd@...db.de>
LKML-Reference: <alpine.LFD.2.01.0907021653030.3210@...alhost.localdomain>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
arch/x86/lib/atomic64_32.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/x86/lib/atomic64_32.c b/arch/x86/lib/atomic64_32.c
index a910238..fd28fd3 100644
--- a/arch/x86/lib/atomic64_32.c
+++ b/arch/x86/lib/atomic64_32.c
@@ -36,7 +36,7 @@ u64 atomic64_xchg(atomic64_t *ptr, u64 new_val)
u64 old_val;
do {
- old_val = atomic_read(ptr);
+ old_val = __atomic64_read(ptr);
} while (atomic64_cmpxchg(ptr, old_val, new_val) != old_val);
return old_val;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists