summaryrefslogtreecommitdiffstats
path: root/kernel/pid.c
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2020-06-09 16:21:38 -0700
committerKees Cook <keescook@chromium.org>2020-07-13 11:03:45 -0700
commit910d2f16ac90463a1f5b03d53246c443e2b354b9 (patch)
tree41a2a88d4cd7dd1de2ce8221d2dc7c2cc96e773e /kernel/pid.c
parentdeefa7f3505ae2fb6a7cb75f50134b65a1dd1494 (diff)
downloadlinux-910d2f16ac90463a1f5b03d53246c443e2b354b9.tar.bz2
pidfd: Replace open-coded receive_fd()
Replace the open-coded version of receive_fd() with a call to the new helper. Thanks to Vamshi K Sthambamkadi <vamshi.k.sthambamkadi@gmail.com> for catching a missed fput() in an earlier version of this patch. Cc: Christoph Hellwig <hch@lst.de> Cc: Jakub Kicinski <kuba@kernel.org> Cc: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org Reviewed-by: Sargun Dhillon <sargun@sargun.me> Acked-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'kernel/pid.c')
-rw-r--r--kernel/pid.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/kernel/pid.c b/kernel/pid.c
index ee58530d1aca..da5aea5f04fa 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -636,19 +636,8 @@ static int pidfd_getfd(struct pid *pid, int fd)
if (IS_ERR(file))
return PTR_ERR(file);
- ret = security_file_receive(file);
- if (ret) {
- fput(file);
- return ret;
- }
-
- ret = get_unused_fd_flags(O_CLOEXEC);
- if (ret < 0) {
- fput(file);
- } else {
- __receive_sock(file);
- fd_install(ret, file);
- }
+ ret = receive_fd(file, O_CLOEXEC);
+ fput(file);
return ret;
}