diff options
| author | Hendrik Brueckner <brueckner@linux.vnet.ibm.com> | 2009-09-16 00:37:25 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2009-09-16 23:57:35 -0400 |
| commit | d9973179aef2af88b6fe4cc1df7ced6fe7cec7d0 (patch) | |
| tree | adfe0033e2ec3eb11cd492ba4b38261257e9c753 /net/iucv | |
| parent | b29e4da41eb1114080b06dce31326d5a0e96a15a (diff) | |
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>
Diffstat (limited to 'net/iucv')
| -rw-r--r-- | net/iucv/af_iucv.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c index 3c915fb42917..21ee68be02ee 100644 --- a/net/iucv/af_iucv.c +++ b/net/iucv/af_iucv.c | |||
| @@ -59,8 +59,8 @@ do { \ | |||
| 59 | DEFINE_WAIT(__wait); \ | 59 | DEFINE_WAIT(__wait); \ |
| 60 | long __timeo = timeo; \ | 60 | long __timeo = timeo; \ |
| 61 | ret = 0; \ | 61 | ret = 0; \ |
| 62 | prepare_to_wait(sk->sk_sleep, &__wait, TASK_INTERRUPTIBLE); \ | ||
| 62 | while (!(condition)) { \ | 63 | while (!(condition)) { \ |
| 63 | prepare_to_wait(sk->sk_sleep, &__wait, TASK_INTERRUPTIBLE); \ | ||
| 64 | if (!__timeo) { \ | 64 | if (!__timeo) { \ |
| 65 | ret = -EAGAIN; \ | 65 | ret = -EAGAIN; \ |
| 66 | break; \ | 66 | break; \ |
