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 <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: 8649c322f7
("pid: Implement pidfd_getfd syscall")
Signed-off-by: Kees Cook <keescook@chromium.org>
This commit is contained in:
parent
d9539752d2
commit
4969f8a073
|
@ -42,6 +42,7 @@
|
||||||
#include <linux/sched/signal.h>
|
#include <linux/sched/signal.h>
|
||||||
#include <linux/sched/task.h>
|
#include <linux/sched/task.h>
|
||||||
#include <linux/idr.h>
|
#include <linux/idr.h>
|
||||||
|
#include <net/sock.h>
|
||||||
|
|
||||||
struct pid init_struct_pid = {
|
struct pid init_struct_pid = {
|
||||||
.count = REFCOUNT_INIT(1),
|
.count = REFCOUNT_INIT(1),
|
||||||
|
@ -642,10 +643,12 @@ static int pidfd_getfd(struct pid *pid, int fd)
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = get_unused_fd_flags(O_CLOEXEC);
|
ret = get_unused_fd_flags(O_CLOEXEC);
|
||||||
if (ret < 0)
|
if (ret < 0) {
|
||||||
fput(file);
|
fput(file);
|
||||||
else
|
} else {
|
||||||
|
__receive_sock(file);
|
||||||
fd_install(ret, file);
|
fd_install(ret, file);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue