From: Amit Shah Date: Thu, 16 Sep 2010 09:13:09 +0000 (+0530) Subject: virtio: console: Disable lseek(2) for port file operations X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=299fb61c08c2fcd1bb6d3a4e87e53dc368475416;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git 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 CC: Arnd Bergmann Signed-off-by: Rusty Russell --- 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) reclaim_consumed_buffers(port); spin_unlock_irq(&port->outvq_lock); + nonseekable_open(inode, filp); + /* Notify host of port being opened */ send_control_msg(filp->private_data, VIRTIO_CONSOLE_PORT_OPEN, 1); @@ -840,6 +842,7 @@ static const struct file_operations port_fops = { .poll = port_fops_poll, .release = port_fops_release, .fasync = port_fops_fasync, + .llseek = no_llseek, }; /*