Commit d9973179 authored by Hendrik Brueckner's avatar Hendrik Brueckner Committed by David S. Miller

af_iucv: fix race in __iucv_sock_wait()

Moving prepare_to_wait before the condition to avoid a race between
schedule_timeout and wake up.
The race can appear during iucv_sock_connect() and iucv_callback_connack().
Signed-off-by: default avatarHendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: default avatarUrsula Braun <ursula.braun@de.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b29e4da4
...@@ -59,8 +59,8 @@ do { \ ...@@ -59,8 +59,8 @@ do { \
DEFINE_WAIT(__wait); \ DEFINE_WAIT(__wait); \
long __timeo = timeo; \ long __timeo = timeo; \
ret = 0; \ ret = 0; \
prepare_to_wait(sk->sk_sleep, &__wait, TASK_INTERRUPTIBLE); \
while (!(condition)) { \ while (!(condition)) { \
prepare_to_wait(sk->sk_sleep, &__wait, TASK_INTERRUPTIBLE); \
if (!__timeo) { \ if (!__timeo) { \
ret = -EAGAIN; \ ret = -EAGAIN; \
break; \ break; \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment