From: Alexei Starovoitov Date: Fri, 12 Feb 2021 03:35:00 +0000 (-0800) Subject: bpf: Clear per_cpu pointers during bpf_prog_realloc X-Git-Tag: v5.15.73~12633^2~28^2~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1336c662474edec3966c96c8de026f794d16b804;p=platform%2Fkernel%2Flinux-rpi.git 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 Fixes: 700d4796ef59 ("bpf: Optimize program stats") Fixes: ca06f55b9002 ("bpf: Add per-program recursion prevention mechanism") Signed-off-by: Alexei Starovoitov --- 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); }