Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp261448pxj; Wed, 16 Jun 2021 01:35:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtdbF4gBz6AXHSQ3VGsDjMROIEulNeo45lBA6/hE0Cu9jPEGOy2i8gjm4EVvDvy2t/olla X-Received: by 2002:a05:6402:270f:: with SMTP id y15mr2825414edd.88.1623832522721; Wed, 16 Jun 2021 01:35:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623832522; cv=none; d=google.com; s=arc-20160816; b=Zc62my4rYxeMj+zPZjbZ4/fuQfIWXWCanXEwBRgRIpRWR4ycdFZBoUegiOCgnsjWVj 1LFup74OfEr2668aQBKbsKSYQw1XAsignvJFfFri9ppLJDpj5ywCmzh46gMXYx+m2dlb DW1QVGVX5tKydVAlLNFshi0GTDYqs24vGU48DcH7MAoO55tFGZkZ4GGvMbIhMkWZJ5KV ekMYLBr1cOQtsOasmCVgJd9Y1DOmAQhpIMsgcmRzsLivY4H7JNu1WTtyNqasYwUYV+oW 9XRZVEkYqf5Ybi7ytuADkBw9+8CytU9CKxiXKRrO1S0en0PZDEWqzeI5ZTglI55U/hPc u3ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=fFxt2RdWQrwlNKLKKDYqPtqKXTc310An8PgfBeLtSz0=; b=puMcwiidZZe0ho7+RcWk4NyvNShECINXrTXLamxGGDT0QJVm+o9ULi7c0j1fU1YhDC ndlscyVYlSqOc8cTtaVtqIwQW5W7FV4GixrKa9Bz41yvuk61TJBWQBzbsfsBUCjgNGz6 Rzz4gdWdL6Dr5z0tRx9Fxcl6M5EylMS8AwEU+Hpc22pe073UZJxeJvMrKT//noOi3K3Y E7ZODayK4pXdsGOb+okkPz6PyYxSxkRHRks7B0fmDGMUw8kHDfCnI64Otfd0xM3Rpw9+ ZsZ9Mzi+vD9cX8gACyJl0SyCZ8C7qOM27vMf0Xcls8WQ9TUh3WDuXu/8EC8W7dMjRRXD HE6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SbDXOT7G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k2si1622841ejd.410.2021.06.16.01.34.59; Wed, 16 Jun 2021 01:35:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SbDXOT7G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231481AbhFPIdT (ORCPT + 99 others); Wed, 16 Jun 2021 04:33:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:39356 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232206AbhFPIdR (ORCPT ); Wed, 16 Jun 2021 04:33:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5B0B06101A; Wed, 16 Jun 2021 08:31:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623832269; bh=UY51MrQ+7PPY4RnoKcsQcpGXMInc7A+QcmPfyyAzw3Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SbDXOT7GkL04NdZGvjRJw/+CD4tZ6qelZ0jlhyFNXW3dJA6DJ5UZ3Sj0PH+juMdzf dh5WrJ/5yAxtlgHq6kW+QuDxuGExgqdvbBrFs9xpImyLUc/4fRCx1+ggTO66DVjttQ isLE+ofTmEq243pk2L8fwhWjbd5JIMlYWk/mbVws= Date: Wed, 16 Jun 2021 10:31:07 +0200 From: Greg Kroah-Hartman To: Viresh Kumar Cc: Rafael Wysocki , Ionela Voinescu , Sudeep Holla , "Rafael J. Wysocki" , linux-pm@vger.kernel.org, Vincent Guittot , Qian Cai , "Paul E . McKenney" , linux-kernel@vger.kernel.org Subject: Re: [PATCH V2 2/3] arch_topology: Avoid use-after-free for scale_freq_data Message-ID: References: <9dba462b4d09a1a8a9fbb75740b74bf91a09a3e1.1623825725.git.viresh.kumar@linaro.org> <20210616081859.idzpwzdyeu666xpz@vireshk-i7> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210616081859.idzpwzdyeu666xpz@vireshk-i7> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 16, 2021 at 01:48:59PM +0530, Viresh Kumar wrote: > On 16-06-21, 09:57, Greg Kroah-Hartman wrote: > > On Wed, Jun 16, 2021 at 12:18:08PM +0530, Viresh Kumar wrote: > > > Currently topology_scale_freq_tick() may end up using a pointer to > > > struct scale_freq_data, which was previously cleared by > > > topology_clear_scale_freq_source(), as there is no protection in place > > > here. The users of topology_clear_scale_freq_source() though needs a > > > guarantee that the previous scale_freq_data isn't used anymore. > > > > > > Since topology_scale_freq_tick() is called from scheduler tick, we don't > > > want to add locking in there. Use the RCU update mechanism instead > > > (which is already used by the scheduler's utilization update path) to > > > guarantee race free updates here. > > > > > > Cc: Paul E. McKenney > > > Signed-off-by: Viresh Kumar > > > > So this is a bugfix for problems in the current codebase? What commit > > does this fix? Should it go to the stable kernels? > > There is only one user of topology_clear_scale_freq_source() > (cppc-cpufreq driver, which is already reverted in pm/linux-next). So > in the upcoming 5.13 kernel release, there will be no one using this > API and so no one will break. > > And so I skipped the fixes tag, I can add it though. It would be nice to have to answer this type of question, otherwise you will have automated scripts trying to backport this to kernels where it does not belong :) thanks, greg k-h