Commit d4badc21 authored by William Stinson's avatar William Stinson Committed by Jeff Garzik

[janitor] update the isicom.c multiport serial driver to

	1) check the result of copy_from_user 
	2) return -EFAULT in case not all data was copied
	3) release resources in case of failure
parent 4d0b85ea
...@@ -1254,7 +1254,11 @@ static int isicom_write(struct tty_struct * tty, int from_user, ...@@ -1254,7 +1254,11 @@ static int isicom_write(struct tty_struct * tty, int from_user,
created more space in xmit_buf when the ctrl created more space in xmit_buf when the ctrl
gets back here */ gets back here */
sti(); sti();
copy_from_user(tmp_buf, buf, cnt); if (copy_from_user(tmp_buf, buf, cnt)) {
up(&tmp_buf_sem);
restore_flags(flags);
return -EFAULT;
}
cli(); cli();
cnt = MIN(cnt, MIN(SERIAL_XMIT_SIZE - port->xmit_cnt - 1, cnt = MIN(cnt, MIN(SERIAL_XMIT_SIZE - port->xmit_cnt - 1,
SERIAL_XMIT_SIZE - port->xmit_head)); SERIAL_XMIT_SIZE - port->xmit_head));
......
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