Skip to content

Commit dca7acd

Browse files
Hou TaoAlexei Starovoitov
authored andcommitted
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 <sfr@canb.auug.org.au> Closes: https://lore.kernel.org/bpf/20230913133436.0eeec4cb@canb.auug.org.au/ Signed-off-by: Hou Tao <houtao1@huawei.com> Tested-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20230913135943.3137292-1-houtao@huaweicloud.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent 837723b commit dca7acd

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

kernel/bpf/memalloc.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,13 @@ static int check_obj_size(struct bpf_mem_cache *c, unsigned int idx)
491491
struct llist_node *first;
492492
unsigned int obj_size;
493493

494+
/* For per-cpu allocator, the size of free objects in free list doesn't
495+
* match with unit_size and now there is no way to get the size of
496+
* per-cpu pointer saved in free object, so just skip the checking.
497+
*/
498+
if (c->percpu_size)
499+
return 0;
500+
494501
first = c->free_llist.first;
495502
if (!first)
496503
return 0;

0 commit comments

Comments
 (0)