mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 15:18:19 +00:00
bpf: btf: fix truncated last_member_type_id in btf_struct_resolve
[ Upstream commita37a32583e
] When trying to finish resolving a struct member, btf_struct_resolve saves the member type id in a u16 temporary variable. This truncates the 32 bit type id value if it exceeds UINT16_MAX. As a result, structs that have members with type ids > UINT16_MAX and which need resolution will fail with a message like this: [67414] STRUCT ff_device size=120 vlen=12 effect_owners type_id=67434 bits_offset=960 Member exceeds struct_size Fix this by changing the type of last_member_type_id to u32. Fixes:a0791f0df7
("bpf: fix BTF limits") Reviewed-by: Stanislav Fomichev <sdf@google.com> Signed-off-by: Lorenz Bauer <oss@lmb.io> Link: https://lore.kernel.org/r/20220910110120.339242-1-oss@lmb.io Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
ee12c2f906
commit
2c40dddbdb
1 changed files with 1 additions and 1 deletions
|
@ -3128,7 +3128,7 @@ static int btf_struct_resolve(struct btf_verifier_env *env,
|
|||
if (v->next_member) {
|
||||
const struct btf_type *last_member_type;
|
||||
const struct btf_member *last_member;
|
||||
u16 last_member_type_id;
|
||||
u32 last_member_type_id;
|
||||
|
||||
last_member = btf_type_member(v->t) + v->next_member - 1;
|
||||
last_member_type_id = last_member->type;
|
||||
|
|
Loading…
Reference in a new issue