Re: [PATCH bpf] bpf: reject ERR_PTR map->record in map_check_btf
From: Alexei Starovoitov
Date: Thu Apr 16 2026 - 11:43:07 EST
On Thu Apr 16, 2026 at 7:48 AM PDT, Sun Jian wrote:
> btf_parse_fields() returns an ERR_PTR() when it encounters an invalid
> special field in map value BTF.
>
> For example, an invalid kptr-annotated field whose tagged pointee is not
> a full struct type can make btf_parse_fields() fail with -EINVAL.
>
> map_check_btf() stores the result in map->record, but currently only
> handles the successful non-NULL case explicitly. ERR_PTR() results are
> not rejected immediately before proceeding with the rest of map BTF
> setup.
yes. So ?
> Handle IS_ERR(map->record) explicitly in map_check_btf() and return the
> underlying error code immediately.
why ?
pw-bot: cr