提交 033a30d6 编写于 作者: A Alexei Starovoitov 提交者: Zheng Zengkai

bpf: Clear per_cpu pointers during bpf_prog_realloc

mainline inclusion
from mainline-5.12-rc1
commit 1336c662
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I5EUVD
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1336c662474edec3966c96c8de026f794d16b804

-------------------------------------------------

bpf_prog_realloc copies contents of struct bpf_prog.
The pointers have to be cleared before freeing old struct.
Reported-by: NIlya Leoshkevich <iii@linux.ibm.com>
Fixes: 700d4796 ("bpf: Optimize program stats")
Fixes: ca06f55b ("bpf: Add per-program recursion prevention mechanism")
Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
(cherry picked from commit 1336c662)
Signed-off-by: NWang Yufen <wangyufen@huawei.com>
上级 abcf69ba
......@@ -255,6 +255,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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册