bpf: Fix error usage of map_fd and fdget() in generic_map_update_batch()
authorXu Kuohai <xukuohai@huawei.com>
Tue, 19 Oct 2021 03:29:34 +0000 (03:29 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 2 Nov 2021 18:48:21 +0000 (19:48 +0100)
commitee4908f909b3761ded2e32c79a6ea5ed20e1fdc6
tree625913769308b78013e290f07941efba6a427945
parentdd2260ec643d309d8c58ceac3aa77f80db765488
bpf: Fix error usage of map_fd and fdget() in generic_map_update_batch()

commit fda7a38714f40b635f5502ec4855602c6b33dad2 upstream.

1. The ufd in generic_map_update_batch() should be read from batch.map_fd;
2. A call to fdget() should be followed by a symmetric call to fdput().

Fixes: aa2e93b8e58e ("bpf: Add generic support for update and delete batch ops")
Signed-off-by: Xu Kuohai <xukuohai@huawei.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20211019032934.1210517-1-xukuohai@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/bpf/syscall.c