Message ID | 20210218001647.71631-1-xiyou.wangcong@gmail.com |
---|---|
State | New |
Headers | show |
Series | [bpf-next,v2] bpf: clear percpu pointers in bpf_prog_clone_free() | expand |
Hello: This patch was applied to bpf/bpf.git (refs/heads/master): On Wed, 17 Feb 2021 16:16:47 -0800 you wrote: > From: Cong Wang <cong.wang@bytedance.com> > > Similar to bpf_prog_realloc(), bpf_prog_clone_create() also copies > the percpu pointers, but the clone still shares them with the original > prog, so we have to clear these two percpu pointers in > bpf_prog_clone_free(). Otherwise we would get a double free: > > [...] Here is the summary with links: - [bpf-next,v2] bpf: clear percpu pointers in bpf_prog_clone_free() https://git.kernel.org/bpf/bpf/c/53f523f3052a You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 0ae015ad1e05..aa1e64196d8d 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -1118,6 +1118,8 @@ static void bpf_prog_clone_free(struct bpf_prog *fp) * clone is guaranteed to not be locked. */ fp->aux = NULL; + fp->stats = NULL; + fp->active = NULL; __bpf_prog_free(fp); }