* [janitor] sunrpc: handle copy*user and put_user errors
@ 2004-01-19 5:13 Randy.Dunlap
2004-01-19 17:34 ` David S. Miller
0 siblings, 1 reply; 2+ messages in thread
From: Randy.Dunlap @ 2004-01-19 5:13 UTC (permalink / raw)
To: davem; +Cc: netdev
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-01-19 17:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-19 5:13 [janitor] sunrpc: handle copy*user and put_user errors Randy.Dunlap
2004-01-19 17:34 ` David S. Miller
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).