aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Mullin <masmullin@hush.com>2015-01-22 16:50:10 -0500
committerAlexandra Yates <alexandra.yates@linux.intel.com>2015-01-28 15:23:59 -0800
commit6fd9ecebd3bc277bd91ce057f85f8e54b09bb0a9 (patch)
tree556277332d5d5e565751a08f5c0e40e2ec0d7a59
parent98f5452d6ae0294a5e2c5211ebc95c4e74ab75c4 (diff)
downloadpowertop-2.0-6fd9ecebd3bc277bd91ce057f85f8e54b09bb0a9.tar.gz
Powertop crashes with 'powertop --auto-tune'
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Please see the following patch to address the reported crash - --- - From e994a414f619410877023fce35ade12d1cfce68d Mon Sep 17 00:00:00 2001 From: Michael Mullin <masmullin@hush.com> Date: Thu, 22 Jan 2015 16:33:31 -0500 Subject: [PATCH] If "dir" is closed early inside create_add_devfreq_devices() then there is a potential double free due to a second close during the cleanup phase in clear_all_devfreq() Signed-off-by: Michael Mullin <masmullin@hush.com> - --- src/devices/devfreq.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
-rw-r--r--src/devices/devfreq.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/devices/devfreq.cpp b/src/devices/devfreq.cpp
index d2e56e3..f652a57 100644
--- a/src/devices/devfreq.cpp
+++ b/src/devices/devfreq.cpp
@@ -247,6 +247,7 @@ void create_all_devfreq_devices(void)
fprintf(stderr, "Devfreq not enabled\n");
is_enabled = false;
closedir(dir);
+ dir = NULL;
return;
}
@@ -327,6 +328,8 @@ void clear_all_devfreq()
}
all_devfreq.clear();
/* close /sys/class/devfreq */
- if (dir != NULL)
+ if (dir != NULL) {
closedir(dir);
+ dir = NULL;
+ }
}