diff options
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r-- | drivers/net/tun.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 807815fc9968..7cb105c103fe 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -1293,7 +1293,8 @@ static ssize_t tun_do_read(struct tun_struct *tun, struct tun_file *tfile, | |||
1293 | if (unlikely(!noblock)) | 1293 | if (unlikely(!noblock)) |
1294 | add_wait_queue(&tfile->wq.wait, &wait); | 1294 | add_wait_queue(&tfile->wq.wait, &wait); |
1295 | while (len) { | 1295 | while (len) { |
1296 | current->state = TASK_INTERRUPTIBLE; | 1296 | if (unlikely(!noblock)) |
1297 | current->state = TASK_INTERRUPTIBLE; | ||
1297 | 1298 | ||
1298 | /* Read frames from the queue */ | 1299 | /* Read frames from the queue */ |
1299 | if (!(skb = skb_dequeue(&tfile->socket.sk->sk_receive_queue))) { | 1300 | if (!(skb = skb_dequeue(&tfile->socket.sk->sk_receive_queue))) { |
@@ -1320,9 +1321,10 @@ static ssize_t tun_do_read(struct tun_struct *tun, struct tun_file *tfile, | |||
1320 | break; | 1321 | break; |
1321 | } | 1322 | } |
1322 | 1323 | ||
1323 | current->state = TASK_RUNNING; | 1324 | if (unlikely(!noblock)) { |
1324 | if (unlikely(!noblock)) | 1325 | current->state = TASK_RUNNING; |
1325 | remove_wait_queue(&tfile->wq.wait, &wait); | 1326 | remove_wait_queue(&tfile->wq.wait, &wait); |
1327 | } | ||
1326 | 1328 | ||
1327 | return ret; | 1329 | return ret; |
1328 | } | 1330 | } |