Skip to content

Commit

Permalink
samples/bpf: Fix fout leak in hbm's run_bpf_prog
Browse files Browse the repository at this point in the history
BugLink: https://bugs.launchpad.net/bugs/2028808

[ Upstream commit 23acb14 ]

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 <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Signed-off-by: Sasha Levin <[email protected]>
Signed-off-by: Kamal Mostafa <[email protected]>
Signed-off-by: Stefan Bader <[email protected]>
  • Loading branch information
Hao Zeng authored and smb49 committed Aug 9, 2023
1 parent b8bc592 commit 4bfb4d2
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions samples/bpf/hbm.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ static int run_bpf_prog(char *prog, int cg_id)
fout = fopen(fname, "w");
fprintf(fout, "id:%d\n", cg_id);
fprintf(fout, "ERROR: Could not lookup queue_stats\n");
fclose(fout);
} else if (stats_flag && qstats.lastPacketTime >
qstats.firstPacketTime) {
long long delta_us = (qstats.lastPacketTime -
Expand Down

0 comments on commit 4bfb4d2

Please sign in to comment.