mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
samples/bpf: Fix fout leak in hbm's run_bpf_prog
[ Upstream commit 23acb14af1 ]
Fix fout being fopen'ed but then not subsequently fclose'd. In the affected
branch, fout is otherwise going out of scope.
Signed-off-by: Hao Zeng <zenghao@kylinos.cn>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20230411084349.1999628-1-zenghao@kylinos.cn
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
ad87bd313f
commit
7560ed6592
@@ -308,6 +308,7 @@ static int run_bpf_prog(char *prog, int cg_id)
|
|||||||
fout = fopen(fname, "w");
|
fout = fopen(fname, "w");
|
||||||
fprintf(fout, "id:%d\n", cg_id);
|
fprintf(fout, "id:%d\n", cg_id);
|
||||||
fprintf(fout, "ERROR: Could not lookup queue_stats\n");
|
fprintf(fout, "ERROR: Could not lookup queue_stats\n");
|
||||||
|
fclose(fout);
|
||||||
} else if (stats_flag && qstats.lastPacketTime >
|
} else if (stats_flag && qstats.lastPacketTime >
|
||||||
qstats.firstPacketTime) {
|
qstats.firstPacketTime) {
|
||||||
long long delta_us = (qstats.lastPacketTime -
|
long long delta_us = (qstats.lastPacketTime -
|
||||||
|
|||||||
Reference in New Issue
Block a user