Skip to content

Commit 0f58e58

Browse files
author
Alexei Starovoitov
committed
Merge branch 'x86-bpf-jit-fixes'
Daniel Borkmann says: ==================== Fix two memory leaks in x86 JIT. For details, please see individual patches in this series. Thanks! ==================== Signed-off-by: Alexei Starovoitov <[email protected]>
2 parents a4e21ff + 39f56ca commit 0f58e58

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/x86/net/bpf_jit_comp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,6 +1236,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
12361236
for (pass = 0; pass < 20 || image; pass++) {
12371237
proglen = do_jit(prog, addrs, image, oldproglen, &ctx);
12381238
if (proglen <= 0) {
1239+
out_image:
12391240
image = NULL;
12401241
if (header)
12411242
bpf_jit_binary_free(header);
@@ -1246,8 +1247,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
12461247
if (proglen != oldproglen) {
12471248
pr_err("bpf_jit: proglen=%d != oldproglen=%d\n",
12481249
proglen, oldproglen);
1249-
prog = orig_prog;
1250-
goto out_addrs;
1250+
goto out_image;
12511251
}
12521252
break;
12531253
}
@@ -1283,7 +1283,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
12831283
prog = orig_prog;
12841284
}
12851285

1286-
if (!prog->is_func || extra_pass) {
1286+
if (!image || !prog->is_func || extra_pass) {
12871287
out_addrs:
12881288
kfree(addrs);
12891289
kfree(jit_data);

0 commit comments

Comments
 (0)