PM / OPP replace kfree_rcu() with call_srcu() in opp_set_availability()
authorViresh Kumar <viresh.kumar@linaro.org>
Thu, 27 Nov 2014 03:24:07 +0000 (08:54 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sat, 29 Nov 2014 22:53:20 +0000 (23:53 +0100)
This existed before we introduced call_srcu() in opp layer to synchronize with
srcu_notifier_call_chain() while removing OPPs. And is a potential bug which
wasn't noticed earlier.

Let fix it as well by using the right API to free OPP.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/power/opp.c

index 977474a3c64fbfaeb26d7f5e0564cd234e0249ab..2d195f3a199899451cfd29ee54949891f85a6a5d 100644 (file)
@@ -641,7 +641,7 @@ static int opp_set_availability(struct device *dev, unsigned long freq,
 
        list_replace_rcu(&opp->node, &new_opp->node);
        mutex_unlock(&dev_opp_list_lock);
-       kfree_rcu(opp, rcu_head);
+       call_srcu(&dev_opp->srcu_head.srcu, &opp->rcu_head, kfree_opp_rcu);
 
        /* Notify the change of the OPP availability */
        if (availability_req)