Commit 2c6607c6 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

net: add POLLPRI to sock_def_readable()

Leonardo Chiquitto found poll() could block forever on tcp sockets and
Urgent data was received, if the event flag only contains POLLPRI.

He did a bisection and found commit 4938d7e0 (poll: avoid extra
wakeups in select/poll) was the source of the problem.

Problem is TCP sockets use standard sock_def_readable() function for
their sk_data_ready() handler, and sock_def_readable() doesnt signal

Only TCP is affected by the problem. Adding POLLPRI to the list of flags
might trigger unnecessary schedules, but URGENT handling is such a
seldom used feature this seems a good compromise.

Thanks a lot to Leonardo for providing the bisection result and a test
program as well.

Reference :

Reported-and-bisected-by: default avatarLeonardo Chiquitto <>
Signed-off-by: default avatarEric Dumazet <>
Tested-by: default avatarEric Dumazet <>
Signed-off-by: default avatarDavid S. Miller <>
parent 3610cda5
......@@ -1908,7 +1908,7 @@ static void sock_def_readable(struct sock *sk, int len)
wq = rcu_dereference(sk->sk_wq);
if (wq_has_sleeper(wq))
wake_up_interruptible_sync_poll(&wq->wait, POLLIN |
wake_up_interruptible_sync_poll(&wq->wait, POLLIN | POLLPRI |
sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment