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
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user