summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-09-21 11:00:09 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-09-21 11:00:09 -0700
commit4e24db5b1a8fe0b0afab875ad2facdfaedce7b07 (patch)
treec5e4bfc2ad68885b1c4925d1a65fd8c7a50ad5aa /drivers
parentb30a3f6257ed2105259b404d419b4964e363928c (diff)
parent9b6efcd2e2275e13403700913b7a1da92cf11ad2 (diff)
downloadlinux-4e24db5b1a8fe0b0afab875ad2facdfaedce7b07.tar.bz2
Merge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus
* git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus: lguest: update comments to reflect LHCALL_LOAD_GDT_ENTRY. virtio: console: Prevent userspace from submitting NULL buffers virtio: console: Fix poll blocking even though there is data to read
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/virtio_console.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 942a9826bd23..c810481a5bc2 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -596,6 +596,10 @@ static ssize_t port_fops_write(struct file *filp, const char __user *ubuf,
ssize_t ret;
bool nonblock;
+ /* Userspace could be out to fool us */
+ if (!count)
+ return 0;
+
port = filp->private_data;
nonblock = filp->f_flags & O_NONBLOCK;
@@ -642,7 +646,7 @@ static unsigned int port_fops_poll(struct file *filp, poll_table *wait)
poll_wait(filp, &port->waitqueue, wait);
ret = 0;
- if (port->inbuf)
+ if (!will_read_block(port))
ret |= POLLIN | POLLRDNORM;
if (!will_write_block(port))
ret |= POLLOUT;