lkml.org 
[lkml]   [2003]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] read(tty, (char *)-1, 1) exempt from EFAULT ?

I had a cut and paste error in my last patch. This should be correct:

--- linux-2.4.20/drivers/char/n_tty.c_orig Tue Mar 18 20:19:33 2003
+++ linux-2.4.20/drivers/char/n_tty.c Tue Mar 18 21:06:57 2003
@@ -1030,7 +1030,10 @@
break;
cs = tty->link->ctrl_status;
tty->link->ctrl_status = 0;
- put_user(cs, b++);
+ if (put_user(cs, b++)) {
+ retval = -EFAULT;
+ break;
+ }
nr--;
break;
}
@@ -1069,7 +1072,10 @@

/* Deal with packet mode. */
if (tty->packet && b == buf) {
- put_user(TIOCPKT_DATA, b++);
+ if (put_user(TIOCPKT_DATA, b++)) {
+ retval = -EFAULT;
+ break;
+ }
nr--;
}

@@ -1096,12 +1102,17 @@
spin_unlock_irqrestore(&tty->read_lock,
flags);

if (!eol || (c != __DISABLED_CHAR)) {
- put_user(c, b++);
+ if (put_user(c, b++)) {
+ retval = -EFAULT;
+ break;
+ }
nr--;
}
if (eol)
break;
}
+ if (retval)
+ break;
} else {
int uncopied;
uncopied = copy_from_read_buf(tty, &b, &nr);
@@ -1136,7 +1147,7 @@

current->state = TASK_RUNNING;
size = b - buf;
- if (size) {
+ if (!retval && size) {
retval = size;
if (nr)
clear_bit(TTY_PUSH, &tty->flags);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:34    [W:0.262 / U:0.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site