aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/virtio_console.c
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2010-09-16 05:13:09 -0400
committerRusty Russell <rusty@rustcorp.com.au>2010-10-21 03:14:04 -0400
commit299fb61c08c2fcd1bb6d3a4e87e53dc368475416 (patch)
tree85a4dd7406b44c8e95c4618c5cb90ae92987cd85 /drivers/char/virtio_console.c
parenta461e11e7b8ca2705889bcf9582f6a8f84884bd2 (diff)
virtio: console: Disable lseek(2) for port file operations
The ports are char devices; do not have seeking capabilities. Calling nonseekable_open() from the fops_open() call and setting the llseek fops pointer to no_llseek ensures an lseek() call from userspace returns -ESPIPE. Signed-off-by: Amit Shah <amit.shah@redhat.com> CC: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/char/virtio_console.c')
-rw-r--r--drivers/char/virtio_console.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index dc42d5689483..6c1b676643a9 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -809,6 +809,8 @@ static int port_fops_open(struct inode *inode, struct file *filp)
809 reclaim_consumed_buffers(port); 809 reclaim_consumed_buffers(port);
810 spin_unlock_irq(&port->outvq_lock); 810 spin_unlock_irq(&port->outvq_lock);
811 811
812 nonseekable_open(inode, filp);
813
812 /* Notify host of port being opened */ 814 /* Notify host of port being opened */
813 send_control_msg(filp->private_data, VIRTIO_CONSOLE_PORT_OPEN, 1); 815 send_control_msg(filp->private_data, VIRTIO_CONSOLE_PORT_OPEN, 1);
814 816
@@ -840,6 +842,7 @@ static const struct file_operations port_fops = {
840 .poll = port_fops_poll, 842 .poll = port_fops_poll,
841 .release = port_fops_release, 843 .release = port_fops_release,
842 .fasync = port_fops_fasync, 844 .fasync = port_fops_fasync,
845 .llseek = no_llseek,
843}; 846};
844 847
845/* 848/*