diff options
author | Daniel Borkmann <daniel@iogearbox.net> | 2017-07-27 21:02:46 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-07-29 14:28:54 -0700 |
commit | 89b096898a8450b0a5b97d521e000ae9f94f81f9 (patch) | |
tree | fab22c5fc592d584692e3b4f29634825d50a1f18 /kernel/bpf | |
parent | c9f2c1ae123a751d4e4f949144500219354d5ee1 (diff) | |
download | op-kernel-dev-89b096898a8450b0a5b97d521e000ae9f94f81f9.zip op-kernel-dev-89b096898a8450b0a5b97d521e000ae9f94f81f9.tar.gz |
bpf: don't indicate success when copy_from_user fails
err in bpf_prog_get_info_by_fd() still holds 0 at that time from prior
check_uarg_tail_zero() check. Explicitly return -EFAULT instead, so
user space can be notified of buggy behavior.
Fixes: 1e2709769086 ("bpf: Add BPF_OBJ_GET_INFO_BY_FD")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/bpf')
-rw-r--r-- | kernel/bpf/syscall.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 045646d..84bb399 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -1289,7 +1289,7 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog, info_len = min_t(u32, sizeof(info), info_len); if (copy_from_user(&info, uinfo, info_len)) - return err; + return -EFAULT; info.type = prog->type; info.id = prog->aux->id; |