File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -196,25 +196,32 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_session *session,
196
196
}
197
197
198
198
if (info_linear -> info_len < offsetof(struct bpf_prog_info , prog_tags )) {
199
+ free (info_linear );
199
200
pr_debug ("%s: the kernel is too old, aborting\n" , __func__ );
200
201
return -2 ;
201
202
}
202
203
203
204
info = & info_linear -> info ;
205
+ if (!info -> jited_ksyms ) {
206
+ free (info_linear );
207
+ return -1 ;
208
+ }
204
209
205
210
/* number of ksyms, func_lengths, and tags should match */
206
211
sub_prog_cnt = info -> nr_jited_ksyms ;
207
212
if (sub_prog_cnt != info -> nr_prog_tags ||
208
- sub_prog_cnt != info -> nr_jited_func_lens )
213
+ sub_prog_cnt != info -> nr_jited_func_lens ) {
214
+ free (info_linear );
209
215
return -1 ;
216
+ }
210
217
211
218
/* check BTF func info support */
212
219
if (info -> btf_id && info -> nr_func_info && info -> func_info_rec_size ) {
213
220
/* btf func info number should be same as sub_prog_cnt */
214
221
if (sub_prog_cnt != info -> nr_func_info ) {
215
222
pr_debug ("%s: mismatch in BPF sub program count and BTF function info count, aborting\n" , __func__ );
216
- err = -1 ;
217
- goto out ;
223
+ free ( info_linear ) ;
224
+ return -1 ;
218
225
}
219
226
if (btf__get_from_id (info -> btf_id , & btf )) {
220
227
pr_debug ("%s: failed to get BTF of id %u, aborting\n" , __func__ , info -> btf_id );
You can’t perform that action at this time.
0 commit comments