diff options
author | Will Deacon <will.deacon@arm.com> | 2019-04-10 13:49:11 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-07-03 14:16:03 +0300 |
commit | 9a53f4f87109ddb1a1a5a29d41d5e540dbafb969 (patch) | |
tree | 6a12f15b19c045967ab231f2864e606ac63462a1 /arch/arm64/include | |
parent | 5a8221bcb056d35c2eee5c5374d05e769f16d138 (diff) | |
download | linux-9a53f4f87109ddb1a1a5a29d41d5e540dbafb969.tar.xz |
arm64: futex: Avoid copying out uninitialised stack in failed cmpxchg()
commit 8e4e0ac02b449297b86498ac24db5786ddd9f647 upstream.
Returning an error code from futex_atomic_cmpxchg_inatomic() indicates
that the caller should not make any use of *uval, and should instead act
upon on the value of the error code. Although this is implemented
correctly in our futex code, we needlessly copy uninitialised stack to
*uval in the error case, which can easily be avoided.
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/arm64/include')
-rw-r--r-- | arch/arm64/include/asm/futex.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/arm64/include/asm/futex.h b/arch/arm64/include/asm/futex.h index c7e30a6ed56e..232917e9c1d9 100644 --- a/arch/arm64/include/asm/futex.h +++ b/arch/arm64/include/asm/futex.h @@ -134,7 +134,9 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *_uaddr, : "memory"); uaccess_disable(); - *uval = val; + if (!ret) + *uval = val; + return ret; } |