diff options
| author | Ingo Molnar <mingo@kernel.org> | 2021-04-20 10:13:58 +0200 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2021-04-20 10:13:58 +0200 |
| commit | d0d252b8ca7a636640a7dca8606edf7c3bcfe0b8 (patch) | |
| tree | 992b53f3c91669f3597e05997b61fa09db2155df /kernel/bpf/stackmap.c | |
| parent | 9406415f46f6127fd31bb66f0260f7a61a8d2786 (diff) | |
| parent | bf05bf16c76bb44ab5156223e1e58e26dfe30a88 (diff) | |
Merge tag 'v5.12-rc8' into sched/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/bpf/stackmap.c')
| -rw-r--r-- | kernel/bpf/stackmap.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c index be35bfb7fb13..6fbc2abe9c91 100644 --- a/kernel/bpf/stackmap.c +++ b/kernel/bpf/stackmap.c @@ -517,9 +517,17 @@ const struct bpf_func_proto bpf_get_stack_proto = { BPF_CALL_4(bpf_get_task_stack, struct task_struct *, task, void *, buf, u32, size, u64, flags) { - struct pt_regs *regs = task_pt_regs(task); + struct pt_regs *regs; + long res; - return __bpf_get_stack(regs, task, NULL, buf, size, flags); + if (!try_get_task_stack(task)) + return -EFAULT; + + regs = task_pt_regs(task); + res = __bpf_get_stack(regs, task, NULL, buf, size, flags); + put_task_stack(task); + + return res; } BTF_ID_LIST_SINGLE(bpf_get_task_stack_btf_ids, struct, task_struct) |
