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-changelog

[Xen-changelog] [xen-unstable] cpufreq: error path fixes

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] cpufreq: error path fixes
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Fri, 14 Oct 2011 18:00:16 +0100
Delivery-date: Fri, 14 Oct 2011 10:02:51 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1318580154 -7200
# Node ID de316831471a8e0f11f615e7bf336dee2ba811e7
# Parent  a65693f9fb1250ff4819774a70284693705db9e7
cpufreq: error path fixes

This fixes an actual bug (failure to exit from a function after an
allocation failure), an inconsistency (not removing the cpufreq_dom
list member upon failure), and a latent bug (not clearing the current
governor upon governor initialization failure when there was no old
one; latent because the only current code path leading to this
situation frees the policy upon failure and hence the governor not
getting cleared is benign).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Keir Fraser <keir@xxxxxxx>
---


diff -r a65693f9fb12 -r de316831471a xen/drivers/cpufreq/cpufreq.c
--- a/xen/drivers/cpufreq/cpufreq.c     Thu Oct 13 15:59:22 2011 +0100
+++ b/xen/drivers/cpufreq/cpufreq.c     Fri Oct 14 10:15:54 2011 +0200
@@ -176,8 +176,10 @@
 
     if (!domexist || hw_all) {
         policy = xzalloc(struct cpufreq_policy);
-        if (!policy)
+        if (!policy) {
             ret = -ENOMEM;
+            goto err0;
+        }
 
         policy->cpu = cpu;
         per_cpu(cpufreq_cpu_policy, cpu) = policy;
@@ -186,7 +188,7 @@
         if (ret) {
             xfree(policy);
             per_cpu(cpufreq_cpu_policy, cpu) = NULL;
-            return ret;
+            goto err0;
         }
         if (cpufreq_verbose)
             printk("CPU %u initialization completed\n", cpu);
@@ -243,7 +245,7 @@
         cpufreq_driver->exit(policy);
         xfree(policy);
     }
-
+err0:
     if (cpus_empty(cpufreq_dom->map)) {
         list_del(&cpufreq_dom->node);
         xfree(cpufreq_dom);
diff -r a65693f9fb12 -r de316831471a xen/drivers/cpufreq/utility.c
--- a/xen/drivers/cpufreq/utility.c     Thu Oct 13 15:59:22 2011 +0100
+++ b/xen/drivers/cpufreq/utility.c     Fri Oct 14 10:15:54 2011 +0200
@@ -458,8 +458,8 @@
                                  data->governor->name);
 
             /* new governor failed, so re-start old one */
+            data->governor = old_gov;
             if (old_gov) {
-                data->governor = old_gov;
                 __cpufreq_governor(data, CPUFREQ_GOV_START);
                 printk(KERN_WARNING "Still stay at %s governor\n",
                                      data->governor->name);

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] cpufreq: error path fixes, Xen patchbot-unstable <=