]> git.baikalelectronics.ru Git - kernel.git/commit
sunrpc: safely reallow resvport min/max inversion
authorJ. Bruce Fields <bfields@redhat.com>
Thu, 18 Oct 2018 19:27:02 +0000 (15:27 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Thu, 18 Oct 2018 21:20:57 +0000 (17:20 -0400)
commit60826553b7e6df6c98673858aef47637c0c35d60
tree8c1998d6ef140e64bd45152d035c087aa356e292
parent8986a21b44f890c327bf080300636bd6f56998bb
sunrpc: safely reallow resvport min/max inversion

Commits 84532f3c5cd5 and 73a0cc4e8fff 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: 84532f3c5cd5 "sunrpc: Prevent resvport min/max inversion..."
Fixes: 73a0cc4e8fff "sunrpc: Prevent rexvport min/max inversion..."
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
net/sunrpc/xprtsock.c