lkml.org 
[lkml]   [2013]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH V2 3/3] tuntap: don't add to waitqueue when POLLERR
Date
Currently, tun_chr_poll() returns POLLERR after waitqueue adding during device
unregistration. This would confuse some of its user such as vhost which assume
when POLLERR is returned, it wasn't added to the waitqueue. Fix this by
returning POLLERR before adding to waitqueue.

Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/net/tun.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index fbd106e..f9c0049 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -886,7 +886,7 @@ static unsigned int tun_chr_poll(struct file *file, poll_table *wait)
struct sock *sk;
unsigned int mask = 0;

- if (!tun)
+ if (!tun || tun->dev->reg_state != NETREG_REGISTERED)
return POLLERR;

sk = tfile->socket.sk;
@@ -903,9 +903,6 @@ static unsigned int tun_chr_poll(struct file *file, poll_table *wait)
sock_writeable(sk)))
mask |= POLLOUT | POLLWRNORM;

- if (tun->dev->reg_state != NETREG_REGISTERED)
- mask = POLLERR;
-
tun_put(tun);
return mask;
}
--
1.7.1


\
 
 \ /
  Last update: 2013-01-05 11:21    [W:0.824 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site