* [PATCH 5.7 055/204] pidfd: Add missing sock updates for pidfd_getfd()
[not found] <20200820091606.194320503@linuxfoundation.org>
@ 2020-08-20 9:19 ` Greg Kroah-Hartman
0 siblings, 0 replies; only message in thread
From: Greg Kroah-Hartman @ 2020-08-20 9:19 UTC (permalink / raw)
To: linux-kernel
Cc: Greg Kroah-Hartman, stable, Christian Brauner, Christoph Hellwig,
Sargun Dhillon, Jakub Kicinski, netdev, Kees Cook
From: Kees Cook <keescook@chromium.org>
commit 4969f8a073977123504609d7310b42a588297aa4 upstream.
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 <christian.brauner@ubuntu.com>
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
Cc: stable@vger.kernel.org
Fixes: 8649c322f75c ("pid: Implement pidfd_getfd syscall")
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/pid.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
--- 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),
@@ -624,10 +625,12 @@ static int pidfd_getfd(struct pid *pid,
}
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;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-08-20 9:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20200820091606.194320503@linuxfoundation.org>
2020-08-20 9:19 ` [PATCH 5.7 055/204] pidfd: Add missing sock updates for pidfd_getfd() Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).