WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH][cpufreq] add bounds checking to cpufreq_stats.c from

To: xen-devel@xxxxxxxxxxxxxxxxxxx, "Joachim Deguara" <joachim.deguara@xxxxxxx>
Subject: [Xen-devel] [PATCH][cpufreq] add bounds checking to cpufreq_stats.c from upstream
From: "Mark Langsdorf" <mark.langsdorf@xxxxxxx>
Date: Wed, 12 Dec 2007 18:18:15 -0600
Delivery-date: Wed, 12 Dec 2007 16:09:56 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.9.6 (enterprise 20070904.708012)
The cpufreq_stats.c will attempt to use an error return value as
an index to an array, causing the kernel to oops.  Stop that by
doing bounds checking.

This is a backport of upstream code.

Signed-off-by: Mark Langsdorf <mark.langsdorf@xxxxxxx>

-Mark Langsdorf
Operating System Research Center
AMD

diff -r cd744c5ec950 drivers/cpufreq/cpufreq_stats.c
--- a/drivers/cpufreq/cpufreq_stats.c   Wed Dec 12 10:18:35 2007 +0000
+++ b/drivers/cpufreq/cpufreq_stats.c   Wed Dec 12 18:02:54 2007 -0600
@@ -292,6 +292,9 @@ cpufreq_stat_notifier_trans (struct noti
        if (old_index == new_index)
                return 0;
 
+        if ((old_index < 0) || (new_index < 0))
+                return 0;
+
        spin_lock(&cpufreq_stats_lock);
        stat->last_index = new_index;
 #ifdef CONFIG_CPU_FREQ_STAT_DETAILS



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH][cpufreq] add bounds checking to cpufreq_stats.c from upstream, Mark Langsdorf <=