sunrpc: handle copy*user and put_user errors
Subsystems (4)
Hi,
Please apply to 2.6.current.
From: Eugene TEO <[email protected]>
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(-)
net/sunrpc/sysctl.c renamed from net/sunrpc/sysctl.c~sunrpc_retval +6 -3
@@ -81,7 +81,8 @@ proc_dodebug(ctl_table *table, int writeif (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
David S. Miller
AppliedQuoted 3 lines · On Sun, 18 Jan 2004 21:13:00 -0800 "Randy.Dunlap" <[email protected]> wrote:
Please apply to 2.6.current.
From: Eugene TEO <[email protected]>
Applied, thanks Randy.