Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 211650
b: refs/heads/master
c: 8ad37e8
h: refs/heads/master
v: v3
  • Loading branch information
Amit Shah authored and Rusty Russell committed Oct 21, 2010
1 parent cad39cc commit 5fc1d00
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7a2853178dfba9553d58f356113f47fd582e9cc6
refs/heads/master: 8ad37e83c8dc413f92b10c3d9bdeabe9237f521d
12 changes: 9 additions & 3 deletions trunk/drivers/char/virtio_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,7 @@ static int port_fops_open(struct inode *inode, struct file *filp)
{
struct cdev *cdev = inode->i_cdev;
struct port *port;
int ret;

port = container_of(cdev, struct port, cdev);
filp->private_data = port;
Expand All @@ -719,14 +720,17 @@ static int port_fops_open(struct inode *inode, struct file *filp)
* Don't allow opening of console port devices -- that's done
* via /dev/hvc
*/
if (is_console_port(port))
return -ENXIO;
if (is_console_port(port)) {
ret = -ENXIO;
goto out;
}

/* Allow only one process to open a particular port at a time */
spin_lock_irq(&port->inbuf_lock);
if (port->guest_connected) {
spin_unlock_irq(&port->inbuf_lock);
return -EMFILE;
ret = -EMFILE;
goto out;
}

port->guest_connected = true;
Expand All @@ -745,6 +749,8 @@ static int port_fops_open(struct inode *inode, struct file *filp)
send_control_msg(filp->private_data, VIRTIO_CONSOLE_PORT_OPEN, 1);

return 0;
out:
return ret;
}

/*
Expand Down

0 comments on commit 5fc1d00

Please sign in to comment.