From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] read(tty, (char *)-1, 1) exempt from EFAULT ?
Date: Tue, 18 Mar 2003 22:05:47 -0500 [thread overview]
Message-ID: <3E77DE8B.5070600@goodmis.org> (raw)
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);
next reply other threads:[~2003-03-19 2:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-19 3:05 Steven Rostedt [this message]
[not found] <3E773A83.9020800@BitWagon.com>
2003-03-19 2:19 ` [PATCH] read(tty, (char *)-1, 1) exempt from EFAULT ? Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3E77DE8B.5070600@goodmis.org \
--to=rostedt@goodmis.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox