Commit 472e449c authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6:
  68328serial: check return value of copy_*_user() instead of access_ok()
  synclink: add mutex_unlock() on error path
  rocket: add a mutex_unlock()
  ip2: return -EFAULT on copy_to_user errors
  ip2: remove unneeded NULL check
  serial: print early console device address in hex
parents 6d87f207 5d56356a
...@@ -1650,7 +1650,7 @@ ip2_close( PTTY tty, struct file *pFile ) ...@@ -1650,7 +1650,7 @@ ip2_close( PTTY tty, struct file *pFile )
/* disable DSS reporting */ /* disable DSS reporting */
i2QueueCommands(PTYPE_INLINE, pCh, 100, 4, i2QueueCommands(PTYPE_INLINE, pCh, 100, 4,
CMD_DCD_NREP, CMD_CTS_NREP, CMD_DSR_NREP, CMD_RI_NREP); CMD_DCD_NREP, CMD_CTS_NREP, CMD_DSR_NREP, CMD_RI_NREP);
if ( !tty || (tty->termios->c_cflag & HUPCL) ) { if (tty->termios->c_cflag & HUPCL) {
i2QueueCommands(PTYPE_INLINE, pCh, 100, 2, CMD_RTSDN, CMD_DTRDN); i2QueueCommands(PTYPE_INLINE, pCh, 100, 2, CMD_RTSDN, CMD_DTRDN);
pCh->dataSetOut &= ~(I2_DTR | I2_RTS); pCh->dataSetOut &= ~(I2_DTR | I2_RTS);
i2QueueCommands( PTYPE_INLINE, pCh, 100, 1, CMD_PAUSE(25)); i2QueueCommands( PTYPE_INLINE, pCh, 100, 1, CMD_PAUSE(25));
...@@ -2930,6 +2930,8 @@ ip2_ipl_ioctl (struct file *pFile, UINT cmd, ULONG arg ) ...@@ -2930,6 +2930,8 @@ ip2_ipl_ioctl (struct file *pFile, UINT cmd, ULONG arg )
if ( pCh ) if ( pCh )
{ {
rc = copy_to_user(argp, pCh, sizeof(i2ChanStr)); rc = copy_to_user(argp, pCh, sizeof(i2ChanStr));
if (rc)
rc = -EFAULT;
} else { } else {
rc = -ENODEV; rc = -ENODEV;
} }
......
...@@ -1244,6 +1244,7 @@ static int set_config(struct tty_struct *tty, struct r_port *info, ...@@ -1244,6 +1244,7 @@ static int set_config(struct tty_struct *tty, struct r_port *info,
} }
info->flags = ((info->flags & ~ROCKET_USR_MASK) | (new_serial.flags & ROCKET_USR_MASK)); info->flags = ((info->flags & ~ROCKET_USR_MASK) | (new_serial.flags & ROCKET_USR_MASK));
configure_r_port(tty, info, NULL); configure_r_port(tty, info, NULL);
mutex_unlock(&info->port.mutex);
return 0; return 0;
} }
......
...@@ -691,8 +691,10 @@ static int open(struct tty_struct *tty, struct file *filp) ...@@ -691,8 +691,10 @@ static int open(struct tty_struct *tty, struct file *filp)
if (info->port.count == 1) { if (info->port.count == 1) {
/* 1st open on this device, init hardware */ /* 1st open on this device, init hardware */
retval = startup(info); retval = startup(info);
if (retval < 0) if (retval < 0) {
mutex_unlock(&info->port.mutex);
goto cleanup; goto cleanup;
}
} }
mutex_unlock(&info->port.mutex); mutex_unlock(&info->port.mutex);
retval = block_til_ready(tty, filp, info); retval = block_til_ready(tty, filp, info);
......
...@@ -869,7 +869,9 @@ static int get_serial_info(struct m68k_serial * info, ...@@ -869,7 +869,9 @@ static int get_serial_info(struct m68k_serial * info,
tmp.close_delay = info->close_delay; tmp.close_delay = info->close_delay;
tmp.closing_wait = info->closing_wait; tmp.closing_wait = info->closing_wait;
tmp.custom_divisor = info->custom_divisor; tmp.custom_divisor = info->custom_divisor;
copy_to_user(retinfo,&tmp,sizeof(*retinfo)); if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
return -EFAULT;
return 0; return 0;
} }
...@@ -882,7 +884,8 @@ static int set_serial_info(struct m68k_serial * info, ...@@ -882,7 +884,8 @@ static int set_serial_info(struct m68k_serial * info,
if (!new_info) if (!new_info)
return -EFAULT; return -EFAULT;
copy_from_user(&new_serial,new_info,sizeof(new_serial)); if (copy_from_user(&new_serial, new_info, sizeof(new_serial)))
return -EFAULT;
old_info = *info; old_info = *info;
if (!capable(CAP_SYS_ADMIN)) { if (!capable(CAP_SYS_ADMIN)) {
...@@ -943,8 +946,7 @@ static int get_lsr_info(struct m68k_serial * info, unsigned int *value) ...@@ -943,8 +946,7 @@ static int get_lsr_info(struct m68k_serial * info, unsigned int *value)
status = 0; status = 0;
#endif #endif
local_irq_restore(flags); local_irq_restore(flags);
put_user(status,value); return put_user(status, value);
return 0;
} }
/* /*
...@@ -999,27 +1001,18 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file, ...@@ -999,27 +1001,18 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
send_break(info, arg ? arg*(100) : 250); send_break(info, arg ? arg*(100) : 250);
return 0; return 0;
case TIOCGSERIAL: case TIOCGSERIAL:
if (access_ok(VERIFY_WRITE, (void *) arg, return get_serial_info(info,
sizeof(struct serial_struct))) (struct serial_struct *) arg);
return get_serial_info(info,
(struct serial_struct *) arg);
return -EFAULT;
case TIOCSSERIAL: case TIOCSSERIAL:
return set_serial_info(info, return set_serial_info(info,
(struct serial_struct *) arg); (struct serial_struct *) arg);
case TIOCSERGETLSR: /* Get line status register */ case TIOCSERGETLSR: /* Get line status register */
if (access_ok(VERIFY_WRITE, (void *) arg, return get_lsr_info(info, (unsigned int *) arg);
sizeof(unsigned int)))
return get_lsr_info(info, (unsigned int *) arg);
return -EFAULT;
case TIOCSERGSTRUCT: case TIOCSERGSTRUCT:
if (!access_ok(VERIFY_WRITE, (void *) arg, if (copy_to_user((struct m68k_serial *) arg,
sizeof(struct m68k_serial))) info, sizeof(struct m68k_serial)))
return -EFAULT; return -EFAULT;
copy_to_user((struct m68k_serial *) arg,
info, sizeof(struct m68k_serial));
return 0; return 0;
default: default:
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
} }
......
...@@ -203,13 +203,13 @@ static int __init parse_options(struct early_serial8250_device *device, ...@@ -203,13 +203,13 @@ static int __init parse_options(struct early_serial8250_device *device,
if (mmio || mmio32) if (mmio || mmio32)
printk(KERN_INFO printk(KERN_INFO
"Early serial console at MMIO%s 0x%llu (options '%s')\n", "Early serial console at MMIO%s 0x%llx (options '%s')\n",
mmio32 ? "32" : "", mmio32 ? "32" : "",
(unsigned long long)port->mapbase, (unsigned long long)port->mapbase,
device->options); device->options);
else else
printk(KERN_INFO printk(KERN_INFO
"Early serial console at I/O port 0x%lu (options '%s')\n", "Early serial console at I/O port 0x%lx (options '%s')\n",
port->iobase, port->iobase,
device->options); device->options);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment