Skip to content
Commit d9105720 authored by Hou Tao's avatar Hou Tao Committed by Greg Kroah-Hartman
Browse files

bpf: Add missed allocation hint for bpf_mem_cache_alloc_flags()

[ Upstream commit 75a44258 ]

bpf_mem_cache_alloc_flags() may call __alloc() directly when there is no
free object in free list, but it doesn't initialize the allocation hint
for the returned pointer. It may lead to bad memory dereference when
freeing the pointer, so fix it by initializing the allocation hint.

Fixes: 822fb26b

 ("bpf: Add a hint to allocated objects.")
Signed-off-by: default avatarHou Tao <houtao1@huawei.com>
Acked-by: default avatarYonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/r/20231111043821.2258513-1-houtao@huaweicloud.com


Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 9453d9a0
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment