]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
bpf: Initialize storage pointers to NULL to prevent freeing garbage pointer
authorAndrii Nakryiko <andriin@fb.com>
Mon, 9 Mar 2020 22:27:55 +0000 (15:27 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Apr 2020 09:00:18 +0000 (11:00 +0200)
commit18ef53f1434e61808eaacdfe9a3835d7f49e86f4
tree0d0dde6161a118ca1d1392a0d6dfc0c4162165e3
parent1bd42713290ebef6d1c3b99a86a89eabe02e984c
bpf: Initialize storage pointers to NULL to prevent freeing garbage pointer

commit 62039c30c19dcab96621e074aeeb90da7100def7 upstream.

Local storage array isn't initialized, so if cgroup storage allocation fails
for BPF_CGROUP_STORAGE_SHARED, error handling code will attempt to free
uninitialized pointer for BPF_CGROUP_STORAGE_PERCPU storage type. Avoid this
by always initializing storage pointers to NULLs.

Fixes: 8bad74f9840f ("bpf: extend cgroup bpf core to allow multiple cgroup storage types")
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200309222756.1018737-1-andriin@fb.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/bpf/cgroup.c