Skip to content

Commit

Permalink
sunrpc: Prevent resvport min/max inversion via sysfs and module param…
Browse files Browse the repository at this point in the history
…eter

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>
  • Loading branch information
Frank Sorenson authored and Trond Myklebust committed Jul 19, 2016
1 parent e08ea3a commit ffb6ca3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion net/sunrpc/xprtsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit ffb6ca3

Please sign in to comment.