Commit 71828b22 authored by Timur Celik's avatar Timur Celik Committed by David S. Miller
Browse files

tun: fix blocking read

This patch moves setting of the current state into the loop. Otherwise
the task may end up in a busy wait loop if none of the break conditions
are met.

Signed-off-by: default avatarTimur Celik <>
Signed-off-by: default avatarDavid S. Miller <>
parent cffde201
......@@ -2167,9 +2167,9 @@ static void *tun_ring_recv(struct tun_file *tfile, int noblock, int *err)
add_wait_queue(&tfile->wq.wait, &wait);
current->state = TASK_INTERRUPTIBLE;
while (1) {
ptr = ptr_ring_consume(&tfile->tx_ring);
if (ptr)
......@@ -2185,7 +2185,7 @@ static void *tun_ring_recv(struct tun_file *tfile, int noblock, int *err)
current->state = TASK_RUNNING;
remove_wait_queue(&tfile->wq.wait, &wait);
Supports Markdown
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