From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752881AbcKUDhh (ORCPT ); Sun, 20 Nov 2016 22:37:37 -0500 Received: from mail-pf0-f181.google.com ([209.85.192.181]:34963 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752480AbcKUDhf (ORCPT ); Sun, 20 Nov 2016 22:37:35 -0500 Date: Mon, 21 Nov 2016 09:07:31 +0530 From: Viresh Kumar To: "Rafael J. Wysocki" Cc: Linux PM list , Linux Kernel Mailing List , Srinivas Pandruvada Subject: Re: [PATCH v2] cpufreq: Avoid using inactive policies Message-ID: <20161121033731.GA4722@vireshk-i7> References: <2709142.YWmMDScDNY@vostro.rjw.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2709142.YWmMDScDNY@vostro.rjw.lan> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18-11-16, 13:40, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > There are two places in the cpufreq core in which low-level driver > callbacks may be invoked for an inactive cpufreq policy, which isn't > guaranteed to work in general. Both are due to possible races with > CPU offline. > > First, in cpufreq_get(), the policy may become inactive after > the check against policy->cpus in cpufreq_cpu_get() and before > policy->rwsem is acquired, in which case using it going forward may > not be correct. > > Second, an analogous situation is possible in cpufreq_update_policy(). > > Avoid using inactive policies by adding policy_is_inactive() checks > to the code in the above places. > > Signed-off-by: Rafael J. Wysocki > --- > > -> v2: > Initialize ret in cpufreq_update_policy() if the inactive policy check > doesn't pass. Acked-by: Viresh Kumar -- viresh