Skip to content

Commit 910d2f1

Browse files
committed
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 <[email protected]> for catching a missed fput() in an earlier version of this patch. Cc: Christoph Hellwig <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: [email protected] Cc: [email protected] Reviewed-by: Sargun Dhillon <[email protected]> Acked-by: Christian Brauner <[email protected]> Signed-off-by: Kees Cook <[email protected]>
1 parent deefa7f commit 910d2f1

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

kernel/pid.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -636,19 +636,8 @@ static int pidfd_getfd(struct pid *pid, int fd)
636636
if (IS_ERR(file))
637637
return PTR_ERR(file);
638638

639-
ret = security_file_receive(file);
640-
if (ret) {
641-
fput(file);
642-
return ret;
643-
}
644-
645-
ret = get_unused_fd_flags(O_CLOEXEC);
646-
if (ret < 0) {
647-
fput(file);
648-
} else {
649-
__receive_sock(file);
650-
fd_install(ret, file);
651-
}
639+
ret = receive_fd(file, O_CLOEXEC);
640+
fput(file);
652641

653642
return ret;
654643
}

0 commit comments

Comments
 (0)