patch-2.1.4 linux/drivers/char/n_tty.c

Next file: linux/drivers/char/pcxx.c
Previous file: linux/drivers/char/mem.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.3/linux/drivers/char/n_tty.c linux/drivers/char/n_tty.c
@@ -743,7 +743,7 @@
 	n = MIN(*nr, MIN(tty->read_cnt, N_TTY_BUF_SIZE - tty->read_tail));
 	if (!n)
 		return;
-	memcpy_tofs(*b, &tty->read_buf[tty->read_tail], n);
+	copy_to_user(*b, &tty->read_buf[tty->read_tail], n);
 	tty->read_tail = (tty->read_tail + n) & (N_TTY_BUF_SIZE-1);
 	tty->read_cnt -= n;
 	*b += n;
@@ -810,9 +810,6 @@
 
 	add_wait_queue(&tty->read_wait, &wait);
 
-	if (exception())
-		goto user_fault;
-
 	disable_bh(TQUEUE_BH);
 	while (1) {
 		/* First test for status change. */
@@ -908,7 +905,6 @@
 			current->timeout = time + jiffies;
 	}
 	enable_bh(TQUEUE_BH);
-	end_exception();
 	remove_wait_queue(&tty->read_wait, &wait);
 
 	if (!waitqueue_active(&tty->read_wait))
@@ -924,12 +920,6 @@
 	if (!size && !retval)
 	        clear_bit(TTY_PUSH, &tty->flags);
 	return (size ? size : retval);
-
-user_fault:
-	enable_bh(TQUEUE_BH);
-	remove_wait_queue(&tty->read_wait, &wait);
-	current->timeout = 0;
-	return -EFAULT;
 }
 
 static int write_chan(struct tty_struct * tty, struct file * file,
@@ -959,17 +949,12 @@
 			break;
 		}
 		if (O_OPOST(tty)) {
-			if (exception()) {
-				retval = -EFAULT;
-				break;
-			}
 			while (nr > 0) {
-				c = get_user(b);
+				get_user(c, b);
 				if (opost(c, tty) < 0)
 					break;
 				b++; nr--;
 			}
-			end_exception();
 			if (tty->driver.flush_chars)
 				tty->driver.flush_chars(tty);
 		} else {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov