Revert "bpf: Add map and need_defer parameters to .map_fd_put_ptr()"

This reverts commit e05b322c82 which is
commit 20c20bd11a0702ce4dc9300c3da58acf551d9725 upstream.

It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.

Bug: 161946584
Change-Id: I7c833819474d28953527a2d06d9d17746c98dfb5
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman
2024-02-02 22:52:35 +00:00
parent 329c931b9d
commit 0125855f7e
5 changed files with 11 additions and 17 deletions

View File

@@ -852,7 +852,7 @@ int bpf_fd_array_map_update_elem(struct bpf_map *map, struct file *map_file,
}
if (old_ptr)
map->ops->map_fd_put_ptr(map, old_ptr, true);
map->ops->map_fd_put_ptr(old_ptr);
return 0;
}
@@ -875,7 +875,7 @@ static int fd_array_map_delete_elem(struct bpf_map *map, void *key)
}
if (old_ptr) {
map->ops->map_fd_put_ptr(map, old_ptr, true);
map->ops->map_fd_put_ptr(old_ptr);
return 0;
} else {
return -ENOENT;
@@ -898,9 +898,8 @@ static void *prog_fd_array_get_ptr(struct bpf_map *map,
return prog;
}
static void prog_fd_array_put_ptr(struct bpf_map *map, void *ptr, bool need_defer)
static void prog_fd_array_put_ptr(void *ptr)
{
/* bpf_prog is freed after one RCU or tasks trace grace period */
bpf_prog_put(ptr);
}
@@ -1186,9 +1185,8 @@ err_out:
return ee;
}
static void perf_event_fd_array_put_ptr(struct bpf_map *map, void *ptr, bool need_defer)
static void perf_event_fd_array_put_ptr(void *ptr)
{
/* bpf_perf_event is freed after one RCU grace period */
bpf_event_entry_free_rcu(ptr);
}
@@ -1241,7 +1239,7 @@ static void *cgroup_fd_array_get_ptr(struct bpf_map *map,
return cgroup_get_from_fd(fd);
}
static void cgroup_fd_array_put_ptr(struct bpf_map *map, void *ptr, bool need_defer)
static void cgroup_fd_array_put_ptr(void *ptr)
{
/* cgroup_put free cgrp after a rcu grace period */
cgroup_put(ptr);