]> 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)
commit2f15f60d233773b687eda07d5bfc5a0ed5c1695e
tree8c1998d6ef140e64bd45152d035c087aa356e292
parent2b065ef8c33e4c10d7f40f5e2993d9d368c8f574
sunrpc: safely reallow resvport min/max inversion

Commits 8d7ddf932d4c and 2cfd90ea262b 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: 8d7ddf932d4c "sunrpc: Prevent resvport min/max inversion..."
Fixes: 2cfd90ea262b "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