Commit 833dd04e authored by Hou Tao's avatar Hou Tao Committed by Zheng Zengkai
Browse files

bpf: Add missed allocation hint for bpf_mem_cache_alloc_flags()

stable inclusion
from stable-v6.6.5
commit d9105720404c2c35ae79949a06a95ce88ef6280e
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8N21P

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=d9105720404c2c35ae79949a06a95ce88ef6280e



--------------------------------

[ Upstream commit 75a442581d05edaee168222ffbe00d4389785636 ]

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>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 0c6d3933
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment