Patch "perf tools: Fix resources leak in perf_data__open_dir()" has been added to the 5.4-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 tools: Fix resources leak in perf_data__open_dir()

to the 5.4-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-tools-fix-resources-leak-in-perf_data__open_dir.patch
and it can be found in the queue-5.4 subdirectory.

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



commit 49eb6ec88a10c5179dd366ae1dddf387b4ca92ed
Author: Miaoqian Lin <linmq006@xxxxxxxxx>
Date:   Thu Dec 29 13:09:00 2022 +0400

    perf tools: Fix resources leak in perf_data__open_dir()
    
    [ Upstream commit 0a6564ebd953c4590663c9a3c99a3ea9920ade6f ]
    
    In perf_data__open_dir(), opendir() opens the directory stream.  Add
    missing closedir() to release it after use.
    
    Fixes: eb6176709b235b96 ("perf data: Add perf_data__open_dir_data function")
    Reviewed-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
    Signed-off-by: Miaoqian Lin <linmq006@xxxxxxxxx>
    Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
    Cc: Alexey Bayduraev <alexey.v.bayduraev@xxxxxxxxxxxxxxx>
    Cc: Ingo Molnar <mingo@xxxxxxxxxx>
    Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
    Cc: Mark Rutland <mark.rutland@xxxxxxx>
    Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
    Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221229090903.1402395-1-linmq006@xxxxxxxxx
    Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c
index 3c874f52f1a2..4da900bdb2f1 100644
--- a/tools/perf/util/data.c
+++ b/tools/perf/util/data.c
@@ -120,6 +120,7 @@ int perf_data__open_dir(struct perf_data *data)
 		file->size = st.st_size;
 	}
 
+	closedir(dir);
 	if (!files)
 		return -EINVAL;
 
@@ -128,6 +129,7 @@ int perf_data__open_dir(struct perf_data *data)
 	return 0;
 
 out_err:
+	closedir(dir);
 	close_dir(files, nr);
 	return ret;
 }



[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