Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp555199pxf; Wed, 31 Mar 2021 09:56:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1Wca+eXgE0bfq14Vna6E6H1Ac5QKSwRrWQIEoTVV4v6NVPpr8u9DDiGawzJLalmavPmM6 X-Received: by 2002:a05:6402:5211:: with SMTP id s17mr4951901edd.327.1617209778158; Wed, 31 Mar 2021 09:56:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617209778; cv=none; d=google.com; s=arc-20160816; b=nyuEgY8NrKfqtRSuqti/z6XmpFN6qHKkPMv1YgDHlpkI+w2GPJ2Wwot3kEei/G5vgU 9zOS2zbDxJYyTSjo79dSWJgPidifiETaOZqXDrE3o1bofeNVgkuSfK0v8NOqAEWXNaVQ Rb2UEnNRboE7ydpXKXngE5MlC/NtmMVmZ27hAqjkUsOfidQ6UdnTX30Fo85s0jadMwA9 RtgNiVed9W9rE7Xf9VKxUsudXPqFfNMKW6ALOy2nTLAfU6ksZ+iiRHe6mBfwntzPtVN9 I//NCQsoa8bsU968lR1Jq2bWiX2O5k8lppeeQxPmY/KVQQFBkwEmFinPVjpykGpBB5bf MEwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=xznif/MH/M9aiazIt+TNwkIsOPRFEi4pc4I4E7feLW4=; b=sn9kfwk1dunY1fHxrUGMrSRo+jEyVCOTgy7Df3nPavEJhgY/3ZL6a/ROS/POt9UzB3 sy21Ezvdvgs8ZjIwbukwD4Py3h6ejS4WceILWDxHapNtz+ZQvNkuNRxNSZ4s9wjveVBD vhO+Y+vvT99YUaOlrOhQLqiK8WRvelciRZi998pUHO4L3OGAr0/+YmbwKPMD0N7JMhGH ZHr29cOQBmyMgMKWqVNYi4WZw6Yh6iuCZJzOj4hQ0Z117bpJ6PUCQSUL2UlwOhPZYXKr P/E7UXBVjHWRymE68p+fWuYROyGz3RU+5CVjt5dATzsswcWfhsnFnjGkzFh1xWmU203E q1Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wk926Zyt; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w24si2249764eds.559.2021.03.31.09.55.52; Wed, 31 Mar 2021 09:56:18 -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=@linaro.org header.s=google header.b=Wk926Zyt; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233735AbhCaQy1 (ORCPT + 99 others); Wed, 31 Mar 2021 12:54:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233867AbhCaQyF (ORCPT ); Wed, 31 Mar 2021 12:54:05 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4824EC061760 for ; Wed, 31 Mar 2021 09:54:04 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id j9so18659154wrx.12 for ; Wed, 31 Mar 2021 09:54:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=xznif/MH/M9aiazIt+TNwkIsOPRFEi4pc4I4E7feLW4=; b=Wk926Zyt5NAXknc85ifZFdrd+TO9JoBNPnmY9WYuuQC33cRHUHTXCafLp14OfaJiok zMDuxi+Yb/lOZIUb5Rq3flGlAl8+qGNspGvohvQDQ/dLV/9RbLPegY3RSWH9PiRYgWed Xoo/3U7DcD62z7r/coj38fXgrNVhte++FvMmm4PsWijLOGrdGHLL9vtNNPE169Fm/1KV 4axDbRRbn1T0aJVToDTbKoPlpZgiUKEqnM5ihaVnBqKxwEyPLqMzBqXcHqCe85WZjeyX 4Xi6neCT47iRXCEEj51oa56gBGTXj4mP2dXtsCdQysbhDOdrK2XoWEt2W5Zq58wTjSgp sf1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=xznif/MH/M9aiazIt+TNwkIsOPRFEi4pc4I4E7feLW4=; b=rpa8z03O7e0DrJz6EmKhmaHBX+0EEYBJ4ewtKuvsIgnaEtZtJie7cWYhYUStnL+DZZ 8bZjooYSDps1NmbehUCkUkH8DMq/NO2cbHZPfI1U3rO06RptHsNyltszC9H+9IRRVmlX Rp/FDYH7XN8WURyC3quOARD5OcSZkyVlFfbs8kWRySNNRJynb5CXCFfC4qAIGUSj43A+ 7BojoW6dZCxSGgkDImo8ubgVK+UoGGjCO6XHBatG/PCVHeOL0QVZ3laP59hj2yqkZutr jTUjFH2C+Cezicd1XyfF0riowubCUuCdmIgAm5sIeoNP2oypHh4nGgF85EqFeIyyrFTt mBBw== X-Gm-Message-State: AOAM531Ch0/7xLfxxhIorpWYjRR8C19s9R4OLN8/M8kbrd1icuQbuIQC 8jl+i9Us0YSeKS9rb3J/FThDMQ== X-Received: by 2002:a05:6000:108b:: with SMTP id y11mr4946180wrw.196.1617209642816; Wed, 31 Mar 2021 09:54:02 -0700 (PDT) Received: from ?IPv6:2a01:e34:ed2f:f020:1573:1dd5:899d:6362? ([2a01:e34:ed2f:f020:1573:1dd5:899d:6362]) by smtp.googlemail.com with ESMTPSA id w6sm5388004wrl.49.2021.03.31.09.54.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 31 Mar 2021 09:54:02 -0700 (PDT) Subject: Re: [PATCH v2] thermal: cpufreq_cooling: fix slab OOB issue To: Michael Kao , fan.chen@mediatek.com, Zhang Rui , linux-pm@vger.kernel.org, srv_heupstream@mediatek.com Cc: Eduardo Valentin , Rob Herring , Mark Rutland , Matthias Brugger , hsinyi@chromium.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, brian-sy yang References: <20201229050831.19493-1-michael.kao@mediatek.com> From: Daniel Lezcano Message-ID: Date: Wed, 31 Mar 2021 18:54:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201229050831.19493-1-michael.kao@mediatek.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/12/2020 06:08, Michael Kao wrote: > From: brian-sy yang > > Slab OOB issue is scanned by KASAN in cpu_power_to_freq(). > If power is limited below the power of OPP0 in EM table, > it will cause slab out-of-bound issue with negative array > index. > > Return the lowest frequency if limited power cannot found > a suitable OPP in EM table to fix this issue. > > Backtrace: > [] die+0x104/0x5ac > [] bug_handler+0x64/0xd0 > [] brk_handler+0x160/0x258 > [] do_debug_exception+0x248/0x3f0 > [] el1_dbg+0x14/0xbc > [] __kasan_report+0x1dc/0x1e0 > [] kasan_report+0x10/0x20 > [] __asan_report_load8_noabort+0x18/0x28 > [] cpufreq_power2state+0x180/0x43c > [] power_actor_set_power+0x114/0x1d4 > [] allocate_power+0xaec/0xde0 > [] power_allocator_throttle+0x3ec/0x5a4 > [] handle_thermal_trip+0x160/0x294 > [] thermal_zone_device_check+0xe4/0x154 > [] process_one_work+0x5e4/0xe28 > [] worker_thread+0xa4c/0xfac > [] kthread+0x33c/0x358 > [] ret_from_fork+0xc/0x18 > > Fixes: 371a3bc79c11b ("thermal/drivers/cpufreq_cooling: Fix wrong frequency converted from power") > Signed-off-by: brian-sy yang > Signed-off-by: Michael Kao > Reviewed-by: Lukasz Luba > --- Applied, thanks -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog