]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blobdiff - kernel/bpf/local_storage.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next
[mirror_ubuntu-eoan-kernel.git] / kernel / bpf / local_storage.c
index 944eb297465fd1c648fc41069e8ea6bb3ff6c976..c97a8f968638c6da0c2ec32c591753f69af59e15 100644 (file)
@@ -130,7 +130,7 @@ static int cgroup_storage_update_elem(struct bpf_map *map, void *_key,
        struct bpf_cgroup_storage *storage;
        struct bpf_storage_buffer *new;
 
-       if (flags & BPF_NOEXIST)
+       if (flags != BPF_ANY && flags != BPF_EXIST)
                return -EINVAL;
 
        storage = cgroup_storage_lookup((struct bpf_cgroup_storage_map *)map,
@@ -261,6 +261,9 @@ static struct bpf_map *cgroup_storage_map_alloc(union bpf_attr *attr)
        if (attr->key_size != sizeof(struct bpf_cgroup_storage_key))
                return ERR_PTR(-EINVAL);
 
+       if (attr->value_size == 0)
+               return ERR_PTR(-EINVAL);
+
        if (attr->value_size > PAGE_SIZE)
                return ERR_PTR(-E2BIG);