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

This reverts commit 80700978cb 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: I884aeffbf2f42c9345f083da594f208e6db4bc9d
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman
2024-04-16 09:40:32 +00:00
parent 379ac05cc3
commit b2600e62c4
5 changed files with 11 additions and 17 deletions

View File

@@ -764,7 +764,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;
}
@@ -787,7 +787,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;
@@ -811,9 +811,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);
}
@@ -1140,9 +1139,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);
}
@@ -1197,7 +1195,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);