]> git.baikalelectronics.ru Git - kernel.git/commit
s390/cmpxchg: fix sign extension bugs
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Tue, 29 May 2012 09:11:51 +0000 (11:11 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 30 May 2012 07:07:58 +0000 (09:07 +0200)
commit647d2dde311ee24d3183c69f04ce39f46cae32cf
tree98ee2bf3d0408f964b85d6135167f50b9821924f
parentcdabc5f7542fe26b530f68c0adc17731518e5b1c
s390/cmpxchg: fix sign extension bugs

For 1 and 2 byte operands for xchg and cmpxchg the old and new values
get or'ed into the larger 4 byte old value before the compare and swap
instruction gets executed. This is done without using the proper byte
mask before or'ing the values.
If the caller passed in negative old or new values these got sign
extended by the caller. Which in turn means that either the old value
never matches, or, even worse, unrelated bytes would be changed in memory.

Luckily there don't seem to be any callers around yet, since that would
have resulted in the specification exception fixed in an earlies patch.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/include/asm/cmpxchg.h