]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
net/scm: Regularize compat handling of scm_detach_fds()
authorKees Cook <keescook@chromium.org>
Tue, 9 Jun 2020 23:11:29 +0000 (16:11 -0700)
committerKees Cook <keescook@chromium.org>
Mon, 13 Jul 2020 18:03:44 +0000 (11:03 -0700)
commitc0029de50982c1fb215330a5f9d433cec0cfd8cc
tree3452e01c860c87aa389cb5f4f5f95f629173fd00
parent4969f8a073977123504609d7310b42a588297aa4
net/scm: Regularize compat handling of scm_detach_fds()

Duplicate the cleanups from commit 2618d530dd8b ("net/scm: cleanup
scm_detach_fds") into the compat code.

Replace open-coded __receive_sock() with a call to the helper.

Move the check added in commit 1f466e1f15cf ("net: cleanly handle kernel
vs user buffers for ->msg_control") to before the compat call, even
though it should be impossible for an in-kernel call to also be compat.

Correct the int "flags" argument to unsigned int to match fd_install()
and similar APIs.

Regularize any remaining differences, including a whitespace issue,
a checkpatch warning, and add the check from commit 6900317f5eff ("net,
scm: fix PaX detected msg_controllen overflow in scm_detach_fds") which
fixed an overflow unique to 64-bit. To avoid confusion when comparing
the compat handler to the native handler, just include the same check
in the compat handler.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Sargun Dhillon <sargun@sargun.me>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
include/net/scm.h
net/compat.c
net/core/scm.c