From patchwork Sun Mar 23 15:09:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 3879341 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9FCBF9F2B6 for ; Sun, 23 Mar 2014 15:11:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D5E702020F for ; Sun, 23 Mar 2014 15:11:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DE37020149 for ; Sun, 23 Mar 2014 15:11:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752545AbaCWPJ1 (ORCPT ); Sun, 23 Mar 2014 11:09:27 -0400 Received: from www.linutronix.de ([62.245.132.108]:58099 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752386AbaCWPJX (ORCPT ); Sun, 23 Mar 2014 11:09:23 -0400 Received: from localhost ([127.0.0.1] helo=ionos.tec.linutronix.de) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1WRk1Z-0005ST-IQ; Sun, 23 Mar 2014 16:09:21 +0100 Message-Id: <20140323150754.272874059@linutronix.de> User-Agent: quilt/0.60-1 Date: Sun, 23 Mar 2014 15:09:32 -0000 From: Thomas Gleixner To: LKML Cc: Julia Lawall , Andrew Morton , "Rafael J. Wysocki" , cpufreq , pm Subject: [patch 15/16] cpufreq: intel-pstate: Use del_timer_sync in intel_pstate_cpu_exit() References: <20140323150557.288925975@linutronix.de> Content-Disposition: inline; filename=cpufreq-intel-pstate-use-del_timer_sync.patch X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1, SHORTCIRCUIT=-0.0001 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We are about to free the data structure. Make sure no timer callback is running. I might be paranoid, but the ->exit callback can be invoked from so many places, that it is not entirely clear whether del_timer is always called on the cpu on which it is enqueued. While looking through the call sites I noticed, that cpufreq_init_policy() can fail and invoke cpufreq_driver->exit() but it does not return the failure and the callsite happily proceeds. Signed-off-by: Thomas Gleixner Cc: "Rafael J. Wysocki" Cc: cpufreq Cc: pm Acked-by: Viresh Kumar --- drivers/cpufreq/intel_pstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: tip/drivers/cpufreq/intel_pstate.c =================================================================== --- tip.orig/drivers/cpufreq/intel_pstate.c +++ tip/drivers/cpufreq/intel_pstate.c @@ -777,7 +777,7 @@ static int intel_pstate_cpu_exit(struct { int cpu = policy->cpu; - del_timer(&all_cpu_data[cpu]->timer); + del_timer_sync(&all_cpu_data[cpu]->timer); kfree(all_cpu_data[cpu]); all_cpu_data[cpu] = NULL; return 0;