]> git.hungrycats.org Git - linux/commitdiff
[SUNRPC]: Handle copy_*_user and put_user errors
authorEugene Teo <eugeneteo@eugeneteo.net>
Mon, 19 Jan 2004 01:38:23 +0000 (17:38 -0800)
committerHideaki Yoshifuji <yoshfuji@linux-ipv6.org>
Mon, 19 Jan 2004 01:38:23 +0000 (17:38 -0800)
net/sunrpc/sysctl.c

index 9dd1231ae26f0fbd894ab9a7ea28bce174f52f5b..b65a32b1c61f5f9e8a99721e00de14f291638550 100644 (file)
@@ -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--;
                }
        }