diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 99ce46f51889..aea9852f1c22 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -4100,7 +4100,9 @@ static int bpf_task_fd_query(const union bpf_attr *attr, if (attr->task_fd_query.flags != 0) return -EINVAL; + rcu_read_lock(); task = get_pid_task(find_vpid(pid), PIDTYPE_PID); + rcu_read_unlock(); if (!task) return -ENOENT;