Skip to content

Commit

Permalink
bpf, s390: Fix potential memory leak about jit_data
Browse files Browse the repository at this point in the history
[ Upstream commit 686cb8b ]

Make sure to free jit_data through kfree() in the error path.

Fixes: 1c8f9b9 ("bpf: s390: add JIT support for multi-function programs")
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Acked-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Tiezhu Yang authored and Greg Kroah-Hartman committed Oct 13, 2021
1 parent 60bacf2 commit a326f9c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/s390/net/bpf_jit_comp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
jit.addrs = kvcalloc(fp->len + 1, sizeof(*jit.addrs), GFP_KERNEL);
if (jit.addrs == NULL) {
fp = orig_fp;
goto out;
goto free_addrs;
}
/*
* Three initial passes:
Expand Down

0 comments on commit a326f9c

Please sign in to comment.