]> git.hungrycats.org Git - linux/commit
arm64: compat: fix stxr failure case in SWP emulation
authorWill Deacon <will.deacon@arm.com>
Thu, 15 Oct 2015 12:55:53 +0000 (13:55 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 Nov 2015 22:37:39 +0000 (14:37 -0800)
commit5ce538743aafc5aef4775ae6e8aed57e23d5e40b
tree1a324b21c677811ef6042abe0a321ee390b53697
parenta7e19859f9fd6eb9e5a11e5645fe42082df40d8a
arm64: compat: fix stxr failure case in SWP emulation

commit 589cb22bbedacf325951014c07a35a2b01ca57f6 upstream.

If the STXR instruction fails in the SWP emulation code, we leave *data
overwritten with the loaded value, therefore corrupting the data written
by a subsequent, successful attempt.

This patch re-jigs the code so that we only write back to *data once we
know that the update has happened.

Fixes: bd35a4adc413 ("arm64: Port SWP/SWPB emulation support from arm")
Reported-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Reported-by: Vladimir Murzin <vladimir.murzin@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/kernel/armv8_deprecated.c