s390: fix preemption race in disable_sacf_uaccess
authorMartin Schwidefsky <schwidefsky@de.ibm.com>
Fri, 15 Dec 2017 13:16:04 +0000 (14:16 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Fri, 15 Dec 2017 14:05:21 +0000 (15:05 +0100)
commit9f37e797547cca9d14fe1f0f43f5c89b261ff0b0
treecce20db0086ff4aeb345991c44ddcb15588a412b
parent366d8216488319ed29308b977cd62b7964a779b7
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>
arch/s390/lib/uaccess.c