Patch "perf header: Fix one memory leakage in process_bpf_btf()" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    perf header: Fix one memory leakage in process_bpf_btf()

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     perf-header-fix-one-memory-leakage-in-process_bpf_bt.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f4af205ea1fa52239f0cd4ead0f8e09bd4a5eea8
Author: Zhongqiu Han <quic_zhonhan@xxxxxxxxxxx>
Date:   Thu Dec 5 16:44:58 2024 +0800

    perf header: Fix one memory leakage in process_bpf_btf()
    
    [ Upstream commit 875d22980a062521beed7b5df71fb13a1af15d83 ]
    
    If __perf_env__insert_btf() returns false due to a duplicate btf node
    insertion, the temporary node will leak. Add a check to ensure the memory
    is freed if the function returns false.
    
    Fixes: a70a1123174ab592 ("perf bpf: Save BTF information as headers to perf.data")
    Reviewed-by: Namhyung Kim <namhyung@xxxxxxxxxx>
    Signed-off-by: Zhongqiu Han <quic_zhonhan@xxxxxxxxxxx>
    Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
    Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
    Cc: Ian Rogers <irogers@xxxxxxxxxx>
    Cc: Ingo Molnar <mingo@xxxxxxxxxx>
    Cc: James Clark <james.clark@xxxxxxxxxx>
    Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
    Cc: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
    Cc: Mark Rutland <mark.rutland@xxxxxxx>
    Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
    Cc: Song Liu <song@xxxxxxxxxx>
    Cc: Yicong Yang <yangyicong@xxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20241205084500.823660-2-quic_zhonhan@xxxxxxxxxxx
    Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index d2812d98968df..a0a83e5de762a 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -2980,7 +2980,8 @@ static int process_bpf_btf(struct feat_fd *ff, void *data __maybe_unused)
 		if (__do_read(ff, node->data, data_size))
 			goto out;
 
-		__perf_env__insert_btf(env, node);
+		if (!__perf_env__insert_btf(env, node))
+			free(node);
 		node = NULL;
 	}
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux