patch-2.3.99-pre6 linux/drivers/char/n_tty.c

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

diff -u --recursive --new-file v2.3.99-pre5/linux/drivers/char/n_tty.c linux/drivers/char/n_tty.c
@@ -226,10 +226,10 @@
 		nr = space;
 	if (nr > sizeof(buf))
 	    nr = sizeof(buf);
-	nr -= copy_from_user(buf, inbuf, nr);
-	if (!nr)
-		return 0;
-	
+
+	if (copy_from_user(buf, inbuf, nr))
+		return -EFAULT;
+
 	for (i = 0, cp = buf; i < nr; i++, cp++) {
 		switch (*cp) {
 		case '\n':
@@ -1166,6 +1166,7 @@
 	return (b - buf) ? b - buf : retval;
 }
 
+/* Called without the kernel lock held - fine */
 static unsigned int normal_poll(struct tty_struct * tty, struct file * file, poll_table *wait)
 {
 	unsigned int mask = 0;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)