Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp838021rwl; Wed, 29 Mar 2023 09:05:47 -0700 (PDT) X-Google-Smtp-Source: AK7set8RjgtebSTE2obP45eFyuk6BYl03eY5RKZGrYA8/0T/0IMqmHdREszgbcb1wR083jlJlta8 X-Received: by 2002:a05:6a20:6695:b0:cc:fa4b:3a6a with SMTP id o21-20020a056a20669500b000ccfa4b3a6amr19258777pzh.58.1680105946963; Wed, 29 Mar 2023 09:05:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680105946; cv=none; d=google.com; s=arc-20160816; b=q45M8EHCfNtzr17dvYHtnlLuACL95T3NI0X7XusBGYaH17f4SG+8ZfBEuQAv4I21wW cViSzLnN3kM5ijxC14gkndN9qzy/0i6PdVFZqj//104KMNVGlrvQHnUi0xfQ9yY/+WWw m+SCaz9W8KqH1VL7JbTznFBeGqsMKe1AzqAUvqHveIU83yClwd6Px2rf5+xWiHj+hm5X Mhq3A8r/IW7uJd2etSMbQHPe19esOMWmKxgPbxD6F8QFAZEyyP6eymduiyyGjwN9t45Z m+el+m/XUjMcQgvQsIjzHycMH9ZgDs6OUJmS6rlR3hDW8MoMnDPKJRCF3k/PjYu6pAfs 9tRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=ArwpNVIf9POAixbklkhIv67If2EwgIZ+QA4ChZDwYgE=; b=Utp5r4ZHcZX618Za8nhSSs5XiUAqVfr9G4WJjsNmQ6/aS59dZJDcZ6xAV1Qc81/xjq dqiwP+SjKtM2rk8+819z6rspfpHmYEiPRRS+FXyZ+6vQL54f7soqERJTtMvkdsgbkIBX 01f5TeUCS3kUnT3Y/ICXEDsE6Yvg6Ea2WMQnDzFHJJGaKJexOXjOVZ02OeO0PlxTbLS7 kwzfN+M7qDMKEEKDCn9/4Omp4fqgi10KAOFrfajZzz2tPR6ngr4OlZ1Bhm+x/eHpVcBM S1+pMvRPqV8puwqCwHQgiMkfZPYp9x3vbyIca33IRbzjYmwjz9OySVL93J+f+lThttCH INww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Idh5bizN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 65-20020a630844000000b00503a9a71e91si31548646pgi.78.2023.03.29.09.05.26; Wed, 29 Mar 2023 09:05:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Idh5bizN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230122AbjC2QCs (ORCPT + 99 others); Wed, 29 Mar 2023 12:02:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231316AbjC2QB4 (ORCPT ); Wed, 29 Mar 2023 12:01:56 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61AF35BB8 for ; Wed, 29 Mar 2023 09:00:44 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id q19so13210960wrc.5 for ; Wed, 29 Mar 2023 09:00:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680105630; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=ArwpNVIf9POAixbklkhIv67If2EwgIZ+QA4ChZDwYgE=; b=Idh5bizNTidzmJWpFEgi4q88BF2+/lO675pVeMaNsr8ygV36SvVkmWzi+QBNiYJKu6 tF5oIdEWoj9xksHV/Xh4B2dTuZbzjgbBCTkwp67pEUOiif8JVbwKT2DIsUJd9GVb3CRo 47Rj6TldHbceb66V68BIp976mKiukc2vkMUla6L7tV9MGqQ4sf2ibQf0WoYH9bCeSFGq NIOlXf1sFNwfiWODEiK8SIJcHA+NJ8UbpqrP+yLm2t/qnphTwYpc6Chxnlotla+7lUiZ lkvuRshIJgjHnsBbpXYjPnD6tIKAeDfnYY1juoZlKdm7rN1zNc6YRdEEtKEaEyhdGSwf yO0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680105630; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ArwpNVIf9POAixbklkhIv67If2EwgIZ+QA4ChZDwYgE=; b=hW0MOYW7fIGrcuJoxkEWRU19UyXeKuru7vYv8+hPbaFO8Qu+bBtx7B13pb2HmzyQBT IYRPmdmaZoL5SSuvBKo/rKiJl7k1BgwKWI2BXlPwjPUUtBpXOZ1QXBeJo1DVrbsGatNn f4ZMQ6GF9BUTa13EtL+5ZSrymJ2Y5o/4NARPn5CH2QmCq0wrLIqcu+oMv9J2iJZ3l+pd I+TvaPRzNd/4Ky3jIluNjn3U0LIpZKLZyjcCxJJbd37YGBujv9SSCOgoMc7d6oaauDFX VMShEvvT1Qt8CLxorgI8ujqBFjTKX5Iq73ro0412pVzFe1+GTNBnmdHI03n21RPnNp9v 68sg== X-Gm-Message-State: AAQBX9dw3WF/rkL+cMYMxocRPGcSQNceNWuZJFbAOTSjvtll/Ar4YJnD lv/+bG4BhYf6bdCx6+x68VHKhA== X-Received: by 2002:a5d:4588:0:b0:2cf:ed87:37c9 with SMTP id p8-20020a5d4588000000b002cfed8737c9mr2251984wrq.11.1680105629985; Wed, 29 Mar 2023 09:00:29 -0700 (PDT) Received: from ?IPV6:2a05:6e02:1041:c10:7c0e:2838:74e9:d05? ([2a05:6e02:1041:c10:7c0e:2838:74e9:d05]) by smtp.googlemail.com with ESMTPSA id b9-20020adfde09000000b002daeb108304sm17446206wrm.33.2023.03.29.09.00.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Mar 2023 09:00:29 -0700 (PDT) Message-ID: <77da9d68-3cb2-f765-21d2-e427776dca44@linaro.org> Date: Wed, 29 Mar 2023 18:00:28 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH -next] thermal/drivers/thermal_hwmon: Fix a kernel NULL pointer dereference Content-Language: en-US To: Zhang Rui , linux-pm@vger.kernel.org, rafael.j.wysocki@intel.com Cc: linux-kernel@vger.kernel.org References: <20230329090055.7537-1-rui.zhang@intel.com> From: Daniel Lezcano In-Reply-To: <20230329090055.7537-1-rui.zhang@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/03/2023 11:00, Zhang Rui wrote: > When the hwmon device node of a thermal zone device is not found, > using hwmon->device causes a kernel NULL pointer dereference. > > Reported-by: Preble Adam C > Signed-off-by: Zhang Rui Acked-by: Daniel Lezcano > --- > Fixes: dec07d399cc8 ("thermal: Don't use 'device' internal thermal zone structure field") > dec07d399cc8 is a commit in the linux-next branch of linux-pm repo. > I'm not sure if the Fix tag applies to such commit or not. > --- > drivers/thermal/thermal_hwmon.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c > index c59db17dddd6..261743f461be 100644 > --- a/drivers/thermal/thermal_hwmon.c > +++ b/drivers/thermal/thermal_hwmon.c > @@ -229,7 +229,7 @@ void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz) > hwmon = thermal_hwmon_lookup_by_type(tz); > if (unlikely(!hwmon)) { > /* Should never happen... */ > - dev_dbg(hwmon->device, "hwmon device lookup failed!\n"); > + dev_dbg(&tz->device, "hwmon device lookup failed!\n"); > return; > } > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog