Re: [PATCH v3 bpf-next 1/5] bpf: Let callers of btf_parse_kptr() track life cycle of prog btf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 8/9/2024 8:51 AM, Amery Hung wrote:
> btf_parse_kptr() and btf_record_free() do btf_get() and btf_put()
> respectively when working on btf_record in program and map if there are
> kptr fields. If the kptr is from program BTF, since both callers has
> already tracked the life cycle of program BTF, it is safe to remove the
> btf_get() and btf_put().
>
> This change prevents memory leak of program BTF later when we start
> searching for kptr fields when building btf_record for program. It can
> happen when the btf fd is closed. The btf_put() corresponding to the
> btf_get() in btf_parse_kptr() was supposed to be called by
> btf_record_free() in btf_free_struct_meta_tab() in btf_free(). However,
> it will never happen since the invocation of btf_free() depends on the
> refcount of the btf to become 0 in the first place.
>
> Signed-off-by: Amery Hung <amery.hung@xxxxxxxxxxxxx>

Acked-by: Hou Tao <houtao1@xxxxxxxxxx>





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux