diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2017-12-15 14:16:04 +0100 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2017-12-15 15:05:21 +0100 |
commit | 9f37e797547cca9d14fe1f0f43f5c89b261ff0b0 (patch) | |
tree | cce20db0086ff4aeb345991c44ddcb15588a412b | |
parent | 366d8216488319ed29308b977cd62b7964a779b7 (diff) | |
download | blackbird-op-linux-9f37e797547cca9d14fe1f0f43f5c89b261ff0b0.tar.gz blackbird-op-linux-9f37e797547cca9d14fe1f0f43f5c89b261ff0b0.zip |
s390: fix preemption race in disable_sacf_uaccess
With CONFIG_PREEMPT=y there is a possible race in disable_sacf_uaccess.
The new set_fs value needs to be stored the the task structure first,
the control register update needs to be second. Otherwise a preemptive
schedule may interrupt the code right after the control register update
has been done and the next time the task is scheduled we get an incorrect
value in the control register due to the old set_fs setting.
Fixes: 0aaba41b58 ("s390: remove all code using the access register mode")
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | arch/s390/lib/uaccess.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/s390/lib/uaccess.c b/arch/s390/lib/uaccess.c index cae5a1e16cbd..c4f8039a35e8 100644 --- a/arch/s390/lib/uaccess.c +++ b/arch/s390/lib/uaccess.c @@ -89,11 +89,11 @@ EXPORT_SYMBOL(enable_sacf_uaccess); void disable_sacf_uaccess(mm_segment_t old_fs) { + current->thread.mm_segment = old_fs; if (old_fs == USER_DS && test_facility(27)) { __ctl_load(S390_lowcore.user_asce, 1, 1); clear_cpu_flag(CIF_ASCE_PRIMARY); } - current->thread.mm_segment = old_fs; } EXPORT_SYMBOL(disable_sacf_uaccess); |