Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / net / sunrpc / sysctl.c
index 730f47d..1065904 100644 (file)
@@ -58,13 +58,14 @@ rpc_unregister_sysctl(void)
 
 static int
 proc_dodebug(ctl_table *table, int write, struct file *file,
-                               void *buffer, size_t *lenp)
+                               void __user *buffer, size_t *lenp, loff_t *ppos)
 {
-       char            tmpbuf[20], *p, c;
+       char            tmpbuf[20], c, *s;
+       char __user *p;
        unsigned int    value;
        size_t          left, len;
 
-       if ((file->f_pos && !write) || !*lenp) {
+       if ((*ppos && !write) || !*lenp) {
                *lenp = 0;
                return 0;
        }
@@ -74,7 +75,7 @@ proc_dodebug(ctl_table *table, int write, struct file *file,
        if (write) {
                if (!access_ok(VERIFY_READ, buffer, left))
                        return -EFAULT;
-               p = (char *) buffer;
+               p = buffer;
                while (left && __get_user(c, p) >= 0 && isspace(c))
                        left--, p++;
                if (!left)
@@ -86,12 +87,12 @@ proc_dodebug(ctl_table *table, int write, struct file *file,
                        return -EFAULT;
                tmpbuf[left] = '\0';
 
-               for (p = tmpbuf, value = 0; '0' <= *p && *p <= '9'; p++, left--)
-                       value = 10 * value + (*p - '0');
-               if (*p && !isspace(*p))
+               for (s = tmpbuf, value = 0; '0' <= *s && *s <= '9'; s++, left--)
+                       value = 10 * value + (*s - '0');
+               if (*s && !isspace(*s))
                        return -EINVAL;
-               while (left && isspace(*p))
-                       left--, p++;
+               while (left && isspace(*s))
+                       left--, s++;
                *(unsigned int *) table->data = value;
                /* Display the RPC tasks on writing to rpc_debug */
                if (table->ctl_name == CTL_RPCDEBUG) {
@@ -106,7 +107,7 @@ proc_dodebug(ctl_table *table, int write, struct file *file,
                if (__copy_to_user(buffer, tmpbuf, len))
                        return -EFAULT;
                if ((left -= len) > 0) {
-                       if (put_user('\n', (char *)buffer + len))
+                       if (put_user('\n', (char __user *)buffer + len))
                                return -EFAULT;
                        left--;
                }
@@ -114,12 +115,15 @@ proc_dodebug(ctl_table *table, int write, struct file *file,
 
 done:
        *lenp -= left;
-       file->f_pos += *lenp;
+       *ppos += *lenp;
        return 0;
 }
 
+
 static unsigned int min_slot_table_size = RPC_MIN_SLOT_TABLE;
 static unsigned int max_slot_table_size = RPC_MAX_SLOT_TABLE;
+static unsigned int xprt_min_resvport_limit = RPC_MIN_RESVPORT;
+static unsigned int xprt_max_resvport_limit = RPC_MAX_RESVPORT;
 
 static ctl_table debug_table[] = {
        {
@@ -176,6 +180,28 @@ static ctl_table debug_table[] = {
                .extra1         = &min_slot_table_size,
                .extra2         = &max_slot_table_size
        },
+       {
+               .ctl_name       = CTL_MIN_RESVPORT,
+               .procname       = "min_resvport",
+               .data           = &xprt_min_resvport,
+               .maxlen         = sizeof(unsigned int),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec_minmax,
+               .strategy       = &sysctl_intvec,
+               .extra1         = &xprt_min_resvport_limit,
+               .extra2         = &xprt_max_resvport_limit
+       },
+       {
+               .ctl_name       = CTL_MAX_RESVPORT,
+               .procname       = "max_resvport",
+               .data           = &xprt_max_resvport,
+               .maxlen         = sizeof(unsigned int),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec_minmax,
+               .strategy       = &sysctl_intvec,
+               .extra1         = &xprt_min_resvport_limit,
+               .extra2         = &xprt_max_resvport_limit
+       },
        { .ctl_name = 0 }
 };