Commit d9973179aef2af88b6fe4cc1df7ced6fe7cec7d0

Authored by Hendrik Brueckner
Committed by David S. Miller
1 parent b29e4da41e

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: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

... ... @@ -59,8 +59,8 @@
59 59 DEFINE_WAIT(__wait); \
60 60 long __timeo = timeo; \
61 61 ret = 0; \
  62 + prepare_to_wait(sk->sk_sleep, &__wait, TASK_INTERRUPTIBLE); \
62 63 while (!(condition)) { \
63   - prepare_to_wait(sk->sk_sleep, &__wait, TASK_INTERRUPTIBLE); \
64 64 if (!__timeo) { \
65 65 ret = -EAGAIN; \
66 66 break; \