union bpf_attr __user *uattr)
 {
        struct bpf_prog_info __user *uinfo = u64_to_user_ptr(attr->info.info);
+       struct btf *attach_btf = bpf_prog_get_target_btf(prog);
        struct bpf_prog_info info;
        u32 info_len = attr->info.info_len;
        struct bpf_prog_kstats stats;
        if (prog->aux->btf)
                info.btf_id = btf_obj_id(prog->aux->btf);
        info.attach_btf_id = prog->aux->attach_btf_id;
-       if (prog->aux->attach_btf)
-               info.attach_btf_obj_id = btf_obj_id(prog->aux->attach_btf);
-       else if (prog->aux->dst_prog)
-               info.attach_btf_obj_id = btf_obj_id(prog->aux->dst_prog->aux->attach_btf);
+       if (attach_btf)
+               info.attach_btf_obj_id = btf_obj_id(attach_btf);
 
        ulen = info.nr_func_info;
        info.nr_func_info = prog->aux->func_info_cnt;