diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2021-07-05 09:05:31 +0300 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2021-07-05 09:05:31 +0300 |
| commit | 818b26588994d9d95743fca0a427f08ec6c1c41d (patch) | |
| tree | 870d9abed0e43b82257350a93e6517816815cd6c /kernel/bpf/stackmap.c | |
| parent | 45a4b68354ffccbc9ca71027bd34754ca24f5183 (diff) | |
| parent | f8f84af5da9ee04ef1d271528656dac42a090d00 (diff) | |
| download | linux-818b26588994d9d95743fca0a427f08ec6c1c41d.tar.xz | |
Merge branch 'next' into for-linus
Prepare input updates for 5.14 merge window.
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) |
