]> git.baikalelectronics.ru Git - kernel.git/commitdiff
bpf: Change kvfree to kfree in generic_map_lookup_batch()
authorDenis Efremov <efremov@linux.com>
Mon, 1 Jun 2020 16:28:14 +0000 (19:28 +0300)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 1 Jun 2020 21:48:33 +0000 (14:48 -0700)
buf_prevkey in generic_map_lookup_batch() is allocated with
kmalloc(). It's safe to free it with kfree().

Fixes: 694a8e604cdc ("bpf: Add generic support for lookup batch op")
Signed-off-by: Denis Efremov <efremov@linux.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20200601162814.17426-1-efremov@linux.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/syscall.c

index 9de3540fa90c4e181212482ec1e9709a66bdc438..e83b0818b52918b690afacde2a41b97fe0bde883 100644 (file)
@@ -1399,7 +1399,7 @@ int generic_map_lookup_batch(struct bpf_map *map,
 
        buf = kmalloc(map->key_size + value_size, GFP_USER | __GFP_NOWARN);
        if (!buf) {
-               kvfree(buf_prevkey);
+               kfree(buf_prevkey);
                return -ENOMEM;
        }