]> git.proxmox.com Git - mirror_ubuntu-bionic-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)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:20:52 +0000 (14:20 -0300)
commit75a210a7637b789372772f4194243dd9c261db93
treef5de416f79187715e041c084335c3ab5f918d37e
parent8d838d2c261a495b035e9c283d8f153caea4795e
sunrpc: safely reallow resvport min/max inversion

BugLink: https://bugs.launchpad.net/bugs/1854975
[ Upstream commit 826799e66e8683e5698e140bb9ef69afc8c0014e ]

Commits ffb6ca33b04b and e08ea3a96fc7 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: ffb6ca33b04b "sunrpc: Prevent resvport min/max inversion..."
Fixes: e08ea3a96fc7 "sunrpc: Prevent rexvport min/max inversion..."
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
net/sunrpc/xprtsock.c