Skip to content

Commit

Permalink
pidfd: Replace open-coded receive_fd()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
kees committed Jul 13, 2020
1 parent deefa7f commit 910d2f1
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions kernel/pid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 910d2f1

Please sign in to comment.