diff options
author | Kees Cook <[email protected]> | 2020-06-09 16:21:38 -0700 |
---|---|---|
committer | Kees Cook <[email protected]> | 2020-07-13 11:03:44 -0700 |
commit | 4969f8a073977123504609d7310b42a588297aa4 (patch) | |
tree | 31bceb2dc20d5a93466bf68d97fbee23e4e4b008 | |
parent | d9539752d23283db4692384a634034f451261e29 (diff) |
pidfd: Add missing sock updates for pidfd_getfd()
The sock counting (sock_update_netprioidx() and sock_update_classid())
was missing from pidfd's implementation of received fd installation. Add
a call to the new __receive_sock() helper.
Cc: Christian Brauner <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: Sargun Dhillon <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Fixes: 8649c322f75c ("pid: Implement pidfd_getfd syscall")
Signed-off-by: Kees Cook <[email protected]>
-rw-r--r-- | kernel/pid.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/kernel/pid.c b/kernel/pid.c index f1496b757162..ee58530d1aca 100644 --- a/kernel/pid.c +++ b/kernel/pid.c @@ -42,6 +42,7 @@ #include <linux/sched/signal.h> #include <linux/sched/task.h> #include <linux/idr.h> +#include <net/sock.h> struct pid init_struct_pid = { .count = REFCOUNT_INIT(1), @@ -642,10 +643,12 @@ static int pidfd_getfd(struct pid *pid, int fd) } ret = get_unused_fd_flags(O_CLOEXEC); - if (ret < 0) + if (ret < 0) { fput(file); - else + } else { + __receive_sock(file); fd_install(ret, file); + } return ret; } |