diff options
| author | Eugene Teo <eugeneteo@eugeneteo.net> | 2004-01-18 17:38:23 -0800 |
|---|---|---|
| committer | Hideaki Yoshifuji <yoshfuji@linux-ipv6.org> | 2004-01-18 17:38:23 -0800 |
| commit | b82e116c49f88283f8b1b720a8b0058ec6c08a00 (patch) | |
| tree | a3dfbddfdc40f2df5dab83f66de10d473c5ea386 | |
| parent | 0ffec775e4eadbd6337692423896196f479f77dd (diff) | |
[SUNRPC]: Handle copy_*_user and put_user errors
| -rw-r--r-- | net/sunrpc/sysctl.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/net/sunrpc/sysctl.c b/net/sunrpc/sysctl.c index 9dd1231ae26f..b65a32b1c61f 100644 --- a/net/sunrpc/sysctl.c +++ b/net/sunrpc/sysctl.c @@ -81,7 +81,8 @@ proc_dodebug(ctl_table *table, int write, struct file *file, 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, struct file *file, 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--; } } |
