diff --git a/powertop-2.7-auto-tune-crash-fix.patch b/powertop-2.7-auto-tune-crash-fix.patch new file mode 100644 index 0000000..97ca259 --- /dev/null +++ b/powertop-2.7-auto-tune-crash-fix.patch @@ -0,0 +1,48 @@ +From 6fd9ecebd3bc277bd91ce057f85f8e54b09bb0a9 Mon Sep 17 00:00:00 2001 +From: Michael Mullin +Date: Thu, 22 Jan 2015 16:50:10 -0500 +Subject: [PATCH] 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 +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 + +- --- + src/devices/devfreq.cpp | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) +--- + src/devices/devfreq.cpp | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +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; ++ } + } diff --git a/powertop.spec b/powertop.spec index d1eb8c9..a6eff67 100644 --- a/powertop.spec +++ b/powertop.spec @@ -1,6 +1,6 @@ Name: powertop Version: 2.7 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Power consumption monitor Group: Applications/System @@ -12,6 +12,8 @@ Source1: powertop.service # Sent upstream Patch0: powertop-2.7-always-create-params.patch Patch1: powertop-2.7-tunable-overflow-fix.patch +# Taken from upstream +Patch2: powertop-2.7-auto-tune-crash-fix.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: gettext, ncurses-devel, pciutils-devel, zlib-devel, libnl3-devel BuildRequires: systemd @@ -27,6 +29,7 @@ computer use more power than necessary while it is idle. %setup -q %patch0 -p1 -b .always-create-params %patch1 -p1 -b .tunable-overfow-fix +%patch2 -p1 -b .autotune-crash-fix %build %configure @@ -67,6 +70,10 @@ rm -rf %{buildroot} %{_unitdir}/powertop.service %changelog +* Fri Jan 30 2015 Jaroslav Škarvada - 2.7-2 +- Fixed crash when running with --auto-tune (by auto-tune-crash-fix patch) + Resolves: rhbz#1187452 + * Tue Nov 25 2014 Jaroslav Škarvada - 2.7-1 - New version Resolves: rhbz#1167726