提交 d9973179 编写于 作者: H Hendrik Brueckner 提交者: 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: NHendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: NUrsula Braun <ursula.braun@de.ibm.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册