diff options
author | Alexei Starovoitov <ast@kernel.org> | 2021-02-12 06:35:00 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2021-02-12 06:35:00 +0300 |
commit | 1336c662474edec3966c96c8de026f794d16b804 (patch) | |
tree | d891b4d525f53a144fe35653153ba84127435b0c /kernel | |
parent | 6fdd671baaf587cca17603485f9ef4bf7a1f9be1 (diff) | |
download | linux-1336c662474edec3966c96c8de026f794d16b804.tar.xz |
bpf: Clear per_cpu pointers during bpf_prog_realloc
bpf_prog_realloc copies contents of struct bpf_prog.
The pointers have to be cleared before freeing old struct.
Reported-by: Ilya Leoshkevich <iii@linux.ibm.com>
Fixes: 700d4796ef59 ("bpf: Optimize program stats")
Fixes: ca06f55b9002 ("bpf: Add per-program recursion prevention mechanism")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/bpf/core.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 334070c4b8a1..0ae015ad1e05 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -245,6 +245,8 @@ struct bpf_prog *bpf_prog_realloc(struct bpf_prog *fp_old, unsigned int size, * reallocated structure. */ fp_old->aux = NULL; + fp_old->stats = NULL; + fp_old->active = NULL; __bpf_prog_free(fp_old); } |