Commit 1336c662 authored by Alexei Starovoitov's avatar Alexei Starovoitov
Browse files

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: default avatarIlya Leoshkevich <iii@linux.ibm.com>
Fixes: 700d4796 ("bpf: Optimize program stats")
Fixes: ca06f55b ("bpf: Add per-program recursion prevention mechanism")
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 6fdd671b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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);
	}