sunrpc: Prevent resvport min/max inversion via sysfs and module parameter
authorFrank Sorenson <sorenson@redhat.com>
Fri, 8 Jul 2016 21:35:25 +0000 (16:35 -0500)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Tue, 19 Jul 2016 20:23:27 +0000 (16:23 -0400)
The current min/max resvport settings are independently limited
by the entire range of allowed ports, so max_resvport can be
set to a port lower than min_resvport.

Prevent inversion of min/max values when set through sysfs and
module parameter by setting the limits dependent on each other.

Signed-off-by: Frank Sorenson <sorenson@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
net/sunrpc/xprtsock.c

index 2674309770f455c85f7a89c8edacf95e77519c9b..83e6f33161499a489c8e49521efa543830a1600f 100644 (file)
@@ -3153,8 +3153,12 @@ static int param_set_uint_minmax(const char *val,
 
 static int param_set_portnr(const char *val, const struct kernel_param *kp)
 {
-       return param_set_uint_minmax(val, kp,
+       if (kp->arg == &xprt_min_resvport)
+               return param_set_uint_minmax(val, kp,
                        RPC_MIN_RESVPORT,
+                       xprt_max_resvport);
+       return param_set_uint_minmax(val, kp,
+                       xprt_min_resvport,
                        RPC_MAX_RESVPORT);
 }