aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHou Tao <[email protected]>2023-09-13 21:59:43 +0800
committerAlexei Starovoitov <[email protected]>2023-09-15 10:22:24 -0700
commitdca7acd84e93f2881e3f63465bbb5d89a40b5d17 (patch)
tree8bf380533d252ace728ae6856e18c5a57b394d3b
parent837723b22a63cfbff584655b009b9d488d0e9087 (diff)
bpf: Skip unit_size checking for global per-cpu allocator
For global per-cpu allocator, the size of free object in free list doesn't match with unit_size and now there is no way to get the size of per-cpu pointer saved in free object, so just skip the checking. Reported-by: Stephen Rothwell <[email protected]> Closes: https://lore.kernel.org/bpf/[email protected]/ Signed-off-by: Hou Tao <[email protected]> Tested-by: Biju Das <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
-rw-r--r--kernel/bpf/memalloc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/bpf/memalloc.c b/kernel/bpf/memalloc.c
index 1c22b90e754a..cf1941516643 100644
--- a/kernel/bpf/memalloc.c
+++ b/kernel/bpf/memalloc.c
@@ -491,6 +491,13 @@ static int check_obj_size(struct bpf_mem_cache *c, unsigned int idx)
struct llist_node *first;
unsigned int obj_size;
+ /* For per-cpu allocator, the size of free objects in free list doesn't
+ * match with unit_size and now there is no way to get the size of
+ * per-cpu pointer saved in free object, so just skip the checking.
+ */
+ if (c->percpu_size)
+ return 0;
+
first = c->free_llist.first;
if (!first)
return 0;