summaryrefslogtreecommitdiffstats
path: root/net/iucv/af_iucv.c
diff options
context:
space:
mode:
authorHendrik Brueckner <brueckner@linux.vnet.ibm.com>2009-09-16 06:37:25 +0200
committerDavid S. Miller <davem@davemloft.net>2009-09-17 05:57:35 +0200
commitd9973179aef2af88b6fe4cc1df7ced6fe7cec7d0 (patch)
treeadfe0033e2ec3eb11cd492ba4b38261257e9c753 /net/iucv/af_iucv.c
parentiucv: use correct output register in iucv_query_maxconn() (diff)
downloadlinux-d9973179aef2af88b6fe4cc1df7ced6fe7cec7d0.tar.xz
linux-d9973179aef2af88b6fe4cc1df7ced6fe7cec7d0.zip
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/af_iucv.c')
-rw-r--r--net/iucv/af_iucv.c2
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 { \
DEFINE_WAIT(__wait); \
long __timeo = timeo; \
ret = 0; \
+ prepare_to_wait(sk->sk_sleep, &__wait, TASK_INTERRUPTIBLE); \
while (!(condition)) { \
- prepare_to_wait(sk->sk_sleep, &__wait, TASK_INTERRUPTIBLE); \
if (!__timeo) { \
ret = -EAGAIN; \
break; \