Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 95159
b: refs/heads/master
c: 5a4bc8c
h: refs/heads/master
i:
  95157: e0173b5
  95155: e37e313
  95151: 7dedeb5
v: v3
  • Loading branch information
Alan Cox authored and Linus Torvalds committed Apr 30, 2008
1 parent f5830e4 commit 7770274
Show file tree
Hide file tree
Showing 2 changed files with 17 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: 37925e050379ef4db9f4ed251786b6d43da6ec71
refs/heads/master: 5a4bc8c1bde7bcb7f02950764e37e9d6bbdb3e32
22 changes: 16 additions & 6 deletions trunk/drivers/char/esp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,7 @@ static int get_serial_info(struct esp_struct * info,
{
struct serial_struct tmp;

lock_kernel();
memset(&tmp, 0, sizeof(tmp));
tmp.type = PORT_16550A;
tmp.line = info->line;
Expand All @@ -1367,6 +1368,7 @@ static int get_serial_info(struct esp_struct * info,
tmp.closing_wait = info->closing_wait;
tmp.custom_divisor = info->custom_divisor;
tmp.hub6 = 0;
unlock_kernel();
if (copy_to_user(retinfo,&tmp,sizeof(*retinfo)))
return -EFAULT;
return 0;
Expand All @@ -1381,13 +1383,15 @@ static int get_esp_config(struct esp_struct * info,
return -EFAULT;

memset(&tmp, 0, sizeof(tmp));
lock_kernel();
tmp.rx_timeout = info->config.rx_timeout;
tmp.rx_trigger = info->config.rx_trigger;
tmp.tx_trigger = info->config.tx_trigger;
tmp.flow_off = info->config.flow_off;
tmp.flow_on = info->config.flow_on;
tmp.pio_threshold = info->config.pio_threshold;
tmp.dma_channel = (info->stat_flags & ESP_STAT_NEVER_DMA ? 0 : dma);
unlock_kernel();

return copy_to_user(retinfo, &tmp, sizeof(*retinfo)) ? -EFAULT : 0;
}
Expand Down Expand Up @@ -1766,6 +1770,7 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
struct serial_icounter_struct __user *p_cuser; /* user space */
void __user *argp = (void __user *)arg;
unsigned long flags;
int ret;

if (serial_paranoia_check(info, tty->name, "rs_ioctl"))
return -ENODEV;
Expand All @@ -1783,7 +1788,10 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
case TIOCGSERIAL:
return get_serial_info(info, argp);
case TIOCSSERIAL:
return set_serial_info(info, argp);
lock_kernel();
ret = set_serial_info(info, argp);
unlock_kernel();
return ret;
case TIOCSERCONFIG:
/* do not reconfigure after initial configuration */
return 0;
Expand Down Expand Up @@ -1855,11 +1863,13 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
return -EFAULT;

return 0;
case TIOCGHAYESESP:
return get_esp_config(info, argp);
case TIOCSHAYESESP:
return set_esp_config(info, argp);

case TIOCGHAYESESP:
return get_esp_config(info, argp);
case TIOCSHAYESESP:
lock_kernel();
ret = set_esp_config(info, argp);
unlock_kernel();
return ret;
default:
return -ENOIOCTLCMD;
}
Expand Down

0 comments on commit 7770274

Please sign in to comment.