Skip to content

Commit 4288ea0

Browse files
Roman Gushchinborkmann
authored andcommitted
bpf: harden flags check in cgroup_storage_update_elem()
cgroup_storage_update_elem() shouldn't accept any flags argument values except BPF_ANY and BPF_EXIST to guarantee the backward compatibility, had a new flag value been added. Fixes: de9cbba ("bpf: introduce cgroup storage maps") Signed-off-by: Roman Gushchin <guro@fb.com> Reported-by: Daniel Borkmann <daniel@iogearbox.net> Cc: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
1 parent d4ce580 commit 4288ea0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎kernel/bpf/local_storage.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static int cgroup_storage_update_elem(struct bpf_map *map, void *_key,
129129
struct bpf_cgroup_storage *storage;
130130
struct bpf_storage_buffer *new;
131131

132-
if (flags & BPF_NOEXIST)
132+
if (flags != BPF_ANY && flags != BPF_EXIST)
133133
return -EINVAL;
134134

135135
storage = cgroup_storage_lookup((struct bpf_cgroup_storage_map *)map,

0 commit comments

Comments
 (0)