netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Randy.Dunlap" <rddunlap@osdl.org>
To: davem@redhat.com
Cc: netdev@oss.sgi.com
Subject: [janitor] sunrpc: handle copy*user and put_user errors
Date: Sun, 18 Jan 2004 21:13:00 -0800	[thread overview]
Message-ID: <20040118211300.3f90c945.rddunlap@osdl.org> (raw)


Hi,
Please apply to 2.6.current.


From: Eugene TEO <eugeneteo@eugeneteo.net>


Patch compiles, and tested. Please apply.

http://www.anomalistic.org/patches/sunrpc-check-ret-fixes-2.6.1-rc1-mm1.patch

diff -Naur -X /home/amnesia/w/dontdiff 2.6.1-rc1-mm1/net/sunrpc/sysctl.c 2.6.1-rc1-mm1-fix/net/sunrpc/sysctl.c

diff -puN net/sunrpc/sysctl.c~sunrpc_retval net/sunrpc/sysctl.c


 linux-261-bk4-kj1-rddunlap/net/sunrpc/sysctl.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff -puN net/sunrpc/sysctl.c~sunrpc_retval net/sunrpc/sysctl.c
--- linux-261-bk4-kj1/net/sunrpc/sysctl.c~sunrpc_retval	2004-01-16 16:03:22.000000000 -0800
+++ linux-261-bk4-kj1-rddunlap/net/sunrpc/sysctl.c	2004-01-16 16:03:22.000000000 -0800
@@ -81,7 +81,8 @@ proc_dodebug(ctl_table *table, int write
 
 		if (left > sizeof(tmpbuf) - 1)
 			return -EINVAL;
-		copy_from_user(tmpbuf, p, left);
+		if (copy_from_user(tmpbuf, p, left))
+			return -EFAULT;
 		tmpbuf[left] = '\0';
 
 		for (p = tmpbuf, value = 0; '0' <= *p && *p <= '9'; p++, left--)
@@ -101,9 +102,11 @@ proc_dodebug(ctl_table *table, int write
 		len = sprintf(tmpbuf, "%d", *(unsigned int *) table->data);
 		if (len > left)
 			len = left;
-		__copy_to_user(buffer, tmpbuf, len);
+		if (__copy_to_user(buffer, tmpbuf, len))
+			return -EFAULT;
 		if ((left -= len) > 0) {
-			put_user('\n', (char *)buffer + len);
+			if (put_user('\n', (char *)buffer + len))
+				return -EFAULT;
 			left--;
 		}
 	}

_


--
~Randy

             reply	other threads:[~2004-01-19  5:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-19  5:13 Randy.Dunlap [this message]
2004-01-19 17:34 ` [janitor] sunrpc: handle copy*user and put_user errors David S. Miller

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=20040118211300.3f90c945.rddunlap@osdl.org \
    --to=rddunlap@osdl.org \
    --cc=davem@redhat.com \
    --cc=netdev@oss.sgi.com \
    /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;
as well as URLs for NNTP newsgroup(s).