Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 95156
b: refs/heads/master
c: e18ce49
h: refs/heads/master
v: v3
  • Loading branch information
Alan Cox authored and Linus Torvalds committed Apr 30, 2008
1 parent e37e313 commit f33eb28
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 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: 00cd5c37afd5f431ac186dd131705048c0a11fdb
refs/heads/master: e18ce49b5b8f957fb99d66990ff49d527f823210
13 changes: 11 additions & 2 deletions trunk/drivers/char/amiserial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,7 @@ static int get_serial_info(struct async_struct * info,
if (!retinfo)
return -EFAULT;
memset(&tmp, 0, sizeof(tmp));
lock_kernel();
tmp.type = state->type;
tmp.line = state->line;
tmp.port = state->port;
Expand All @@ -1084,6 +1085,7 @@ static int get_serial_info(struct async_struct * info,
tmp.close_delay = state->close_delay;
tmp.closing_wait = state->closing_wait;
tmp.custom_divisor = state->custom_divisor;
unlock_kernel();
if (copy_to_user(retinfo,&tmp,sizeof(*retinfo)))
return -EFAULT;
return 0;
Expand All @@ -1099,13 +1101,17 @@ static int set_serial_info(struct async_struct * info,

if (copy_from_user(&new_serial,new_info,sizeof(new_serial)))
return -EFAULT;

lock_kernel();
state = info->state;
old_state = *state;

change_irq = new_serial.irq != state->irq;
change_port = (new_serial.port != state->port);
if(change_irq || change_port || (new_serial.xmit_fifo_size != state->xmit_fifo_size))
if(change_irq || change_port || (new_serial.xmit_fifo_size != state->xmit_fifo_size)) {
unlock_kernel();
return -EINVAL;
}

if (!serial_isroot()) {
if ((new_serial.baud_base != state->baud_base) ||
Expand All @@ -1122,8 +1128,10 @@ static int set_serial_info(struct async_struct * info,
goto check_and_exit;
}

if (new_serial.baud_base < 9600)
if (new_serial.baud_base < 9600) {
unlock_kernel();
return -EINVAL;
}

/*
* OK, past this point, all the error checking has been done.
Expand Down Expand Up @@ -1157,6 +1165,7 @@ static int set_serial_info(struct async_struct * info,
}
} else
retval = startup(info);
unlock_kernel();
return retval;
}

Expand Down

0 comments on commit f33eb28

Please sign in to comment.