Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 207887
b: refs/heads/master
c: bf936f9
h: refs/heads/master
i:
  207885: b7efb09
  207883: e77c14f
  207879: a39bdb2
  207871: e428368
v: v3
  • Loading branch information
Alan Cox authored and Greg Kroah-Hartman committed Aug 10, 2010
1 parent 79dfaa9 commit d3abede
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 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: 8a1e803d0148e320b9200a442dfb88f8cbde88e7
refs/heads/master: bf936f92a7a564a2cdb44bbe3bc797cd811bf625
14 changes: 8 additions & 6 deletions trunk/drivers/char/riscom8.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/tty_flip.h>
#include <linux/smp_lock.h>
#include <linux/spinlock.h>
#include <linux/device.h>

Expand Down Expand Up @@ -1184,15 +1183,18 @@ static int rc_set_serial_info(struct tty_struct *tty, struct riscom_port *port,
if (copy_from_user(&tmp, newinfo, sizeof(tmp)))
return -EFAULT;

mutex_lock(&port->port.mutex);
change_speed = ((port->port.flags & ASYNC_SPD_MASK) !=
(tmp.flags & ASYNC_SPD_MASK));

if (!capable(CAP_SYS_ADMIN)) {
if ((tmp.close_delay != port->port.close_delay) ||
(tmp.closing_wait != port->port.closing_wait) ||
((tmp.flags & ~ASYNC_USR_MASK) !=
(port->port.flags & ~ASYNC_USR_MASK)))
(port->port.flags & ~ASYNC_USR_MASK))) {
mutex_unlock(&port->port.mutex);
return -EPERM;
}
port->port.flags = ((port->port.flags & ~ASYNC_USR_MASK) |
(tmp.flags & ASYNC_USR_MASK));
} else {
Expand All @@ -1208,6 +1210,7 @@ static int rc_set_serial_info(struct tty_struct *tty, struct riscom_port *port,
rc_change_speed(tty, bp, port);
spin_unlock_irqrestore(&riscom_lock, flags);
}
mutex_unlock(&port->port.mutex);
return 0;
}

Expand All @@ -1220,12 +1223,15 @@ static int rc_get_serial_info(struct riscom_port *port,
memset(&tmp, 0, sizeof(tmp));
tmp.type = PORT_CIRRUS;
tmp.line = port - rc_port;

mutex_lock(&port->port.mutex);
tmp.port = bp->base;
tmp.irq = bp->irq;
tmp.flags = port->port.flags;
tmp.baud_base = (RC_OSCFREQ + CD180_TPC/2) / CD180_TPC;
tmp.close_delay = port->port.close_delay * HZ/100;
tmp.closing_wait = port->port.closing_wait * HZ/100;
mutex_unlock(&port->port.mutex);
tmp.xmit_fifo_size = CD180_NFIFO;
return copy_to_user(retinfo, &tmp, sizeof(tmp)) ? -EFAULT : 0;
}
Expand All @@ -1242,14 +1248,10 @@ static int rc_ioctl(struct tty_struct *tty, struct file *filp,

switch (cmd) {
case TIOCGSERIAL:
lock_kernel();
retval = rc_get_serial_info(port, argp);
unlock_kernel();
break;
case TIOCSSERIAL:
lock_kernel();
retval = rc_set_serial_info(tty, port, argp);
unlock_kernel();
break;
default:
retval = -ENOIOCTLCMD;
Expand Down

0 comments on commit d3abede

Please sign in to comment.