• J. Bruce Fields's avatar
    sunrpc: safely reallow resvport min/max inversion · f9304c62
    J. Bruce Fields authored
    [ Upstream commit 826799e6 ]
    
    Commits ffb6ca33 and e08ea3a9 prevent setting xprt_min_resvport
    greater than xprt_max_resvport, but may also break simple code that sets
    one parameter then the other, if the new range does not overlap the old.
    
    Also it looks racy to me, unless there's some serialization I'm not
    seeing.  Granted it would probably require malicious privileged processes
    (unless there's a chance these might eventually be settable in unprivileged
    containers), but still it seems better not to let userspace panic the
    kernel.
    
    Simpler seems to be to allow setting the parameters to whatever you want
    but interpret xprt_min_resvport > xprt_max_resvport as the empty range.
    
    Fixes: ffb6ca33 "sunrpc: Prevent resvport min/max inversion..."
    Fixes: e08ea3a9 "sunrpc: Prevent rexvport min/max inversion..."
    Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
    Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
    Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
    f9304c62
xprtsock.c 87.7 KB