summaryrefslogtreecommitdiffstats
path: root/net/phonet/pep.c
diff options
context:
space:
mode:
authorWANG Cong <xiyou.wangcong@gmail.com>2016-11-11 13:20:50 -0500
committerDavid S. Miller <davem@davemloft.net>2016-11-14 13:17:21 -0500
commitd9dc8b0f8b4ec8cdc48ad5a20a3105387138be82 (patch)
treea28c86da1c3ba7fef0f3fa82a5c7fc5bbb6fe2bf /net/phonet/pep.c
parent7d384846b9987f7b611357adf3cdfecfdcf0c402 (diff)
net: fix sleeping for sk_wait_event()
Similar to commit 14135f30e33c ("inet: fix sleeping inside inet_wait_for_connect()"), sk_wait_event() needs to fix too, because release_sock() is blocking, it changes the process state back to running after sleep, which breaks the previous prepare_to_wait(). Switch to the new wait API. Cc: Eric Dumazet <eric.dumazet@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/phonet/pep.c')
-rw-r--r--net/phonet/pep.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/net/phonet/pep.c b/net/phonet/pep.c
index 850a86cde0b3..8bad5624a27a 100644
--- a/net/phonet/pep.c
+++ b/net/phonet/pep.c
@@ -1167,7 +1167,7 @@ disabled:
1167 /* Wait until flow control allows TX */ 1167 /* Wait until flow control allows TX */
1168 done = atomic_read(&pn->tx_credits); 1168 done = atomic_read(&pn->tx_credits);
1169 while (!done) { 1169 while (!done) {
1170 DEFINE_WAIT(wait); 1170 DEFINE_WAIT_FUNC(wait, woken_wake_function);
1171 1171
1172 if (!timeo) { 1172 if (!timeo) {
1173 err = -EAGAIN; 1173 err = -EAGAIN;
@@ -1178,10 +1178,9 @@ disabled:
1178 goto out; 1178 goto out;
1179 } 1179 }
1180 1180
1181 prepare_to_wait(sk_sleep(sk), &wait, 1181 add_wait_queue(sk_sleep(sk), &wait);
1182 TASK_INTERRUPTIBLE); 1182 done = sk_wait_event(sk, &timeo, atomic_read(&pn->tx_credits), &wait);
1183 done = sk_wait_event(sk, &timeo, atomic_read(&pn->tx_credits)); 1183 remove_wait_queue(sk_sleep(sk), &wait);
1184 finish_wait(sk_sleep(sk), &wait);
1185 1184
1186 if (sk->sk_state != TCP_ESTABLISHED) 1185 if (sk->sk_state != TCP_ESTABLISHED)
1187 goto disabled; 1186 goto disabled;