Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp861494rwl; Wed, 29 Mar 2023 09:21:13 -0700 (PDT) X-Google-Smtp-Source: AKy350bBQMvyfSMYyqYYC0HMwhyRoqZv7sTm/74vgIOuMsFiq47JQDnqsOo7FWCrWh7kd/OnhkEx X-Received: by 2002:a17:906:1d0a:b0:8b1:7b10:61d5 with SMTP id n10-20020a1709061d0a00b008b17b1061d5mr22071200ejh.33.1680106873534; Wed, 29 Mar 2023 09:21:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680106873; cv=none; d=google.com; s=arc-20160816; b=pLeBYvkGwNjJAbzlMh8Dr2FS5DdxDBwOW0yKt/x1FmC2MVSHb5dm1MWVQk2DFYxiHJ uIO3Jh4WU9BHdr1ouwGNUdsTbGRbWhVLxk+M+8HkMoHC5Fr0OvLiDv4q8AXvqaQT98+4 bJ+0LOC/r3jSBLpa9eF/dmam4babcm7i/nAzwdAr0ZYWhxxsUreIff4OFTY5sqIn0Vj5 cwj9aL6ArvC6WZeJyUg0P1V/MTfxiO7zqeSBDEUqYyCzBT+aobdw9pFELWhH4ku4nHTe WbfwN6bZZqD/rK5EGbUUeNEMUrKPx5rcTXGc6oHmUTsF2D3e8iTivHStDnkzuIEiOG6E SURw== 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=U/3ZXVoIKxVs/p2ePsaiOudqZVjYFCyOHTolPsKeMIE=; b=FQ8SvQgk/fhvOWWt7Yzinhi3GqSGGEkOVkZa7et3B4S9fBC0xQTEkfir8ri4YmC4xF xBiJeyRGAE3rwlotrdiFCv+oKIsB8WCu1G6jVLljZxm9e4QXXsr8Cfh/Y76cQVhPcW2m OB98TbLh53f0uvlVgAtIQLKAcJ02guvA7I11o5FyKXK8RA3l7byEQNpiLYjWgyH+9l2S gWEya9pD6Bjkb+MDDjz9ZxIn50h3jsHug39RZ0mUqA/FAdMv2S+/hniaB5QtUK6VswRD 5+NO94rCb6bW4tvpwHceRvy5xFlVJXqZEw5ZQL1v+8tZ0rC18n7XZf+ixpjQEodWnzEE +3Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zhBeRzLj; 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 oz31-20020a1709077d9f00b0093defbd6280si17021567ejc.1031.2023.03.29.09.20.48; Wed, 29 Mar 2023 09:21:13 -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=zhBeRzLj; 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 S229529AbjC2QTJ (ORCPT + 99 others); Wed, 29 Mar 2023 12:19:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229919AbjC2QTA (ORCPT ); Wed, 29 Mar 2023 12:19:00 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2041A4233 for ; Wed, 29 Mar 2023 09:18:35 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id n10-20020a05600c4f8a00b003ee93d2c914so11496906wmq.2 for ; Wed, 29 Mar 2023 09:18:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680106713; 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=U/3ZXVoIKxVs/p2ePsaiOudqZVjYFCyOHTolPsKeMIE=; b=zhBeRzLjXXN7jqHGC5Zw1MCquTnjs3lNKA492yHvqv0SUf7DJk+Tnys0BFYYF2YGAW yUw+JIaXTFsSCqebewTBv4ccDWzd+b8a1dy9I3wcnlN8oQx/7t1b//sWMXV5sR8l5LE+ sLQiyvWhw8EwtSFoAR3IBGHWd5kSohsAKhLcknR4BTxhUGma3FVv6JpS/d0Rq6r4O63S L9viX+3tSrw71RNxR02c/BnChgQAJUCub/+VjrcwJcHYNRwF5GjJ82mTe5rdQkF7nGfN h/HOwKTCyGriCjbcC4cTSfpQB9olMxKXwNHZLZV8j3/k3gutSPSsI+XM34N0TbABzuYk gKXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680106713; 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=U/3ZXVoIKxVs/p2ePsaiOudqZVjYFCyOHTolPsKeMIE=; b=iijK8zm6s/UK43HjXTCQqRTMFF0vpbODxUYaCGLtMwlbwXzNTG2Hufd011AgPuAqqU We54cNJaNCDcb4oMMSJHQjEwE6txrMwKBQOJnoRHc/HUW0DkNUuFFDerkyNw9lzYVV6l 4Y0OerM+lt9d5GovCKrbM50ehBbjHUFsowkZWAh3oaLzl46ymO3rroY523BxBeup4kG0 0sPlHgYJZ0/rZ5lKjrVX6LWFyBROiOsRhkLv3z3q8YUWY7UfoyDMck6Nkw6PEI0svhlR QnhQDOi+Ja5b3wZEvuzm9zH/RKYIm0TZz9HKgpEgfOHS3GNb+cpc3orurSXojQZqL9/n vfHw== X-Gm-Message-State: AO0yUKWMH9iZfHHLcT02Of8JPg4qxXzI6pnPilY51VZByue2fPj5rj94 6Mw/l2K5tbZRbxw2Arc1/sagIQ== X-Received: by 2002:a7b:c8c4:0:b0:3ed:ce6f:e86e with SMTP id f4-20020a7bc8c4000000b003edce6fe86emr15341004wml.23.1680106713524; Wed, 29 Mar 2023 09:18:33 -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 fc11-20020a05600c524b00b003ebff290a52sm2956826wmb.28.2023.03.29.09.18.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Mar 2023 09:18:32 -0700 (PDT) Message-ID: <5b084360-898b-aad0-0b8e-33acc585d71d@linaro.org> Date: Wed, 29 Mar 2023 18:18:31 +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: "Rafael J. Wysocki" Cc: Zhang Rui , linux-pm@vger.kernel.org, rafael.j.wysocki@intel.com, linux-kernel@vger.kernel.org References: <20230329090055.7537-1-rui.zhang@intel.com> <08aee7fe-eddc-7841-2539-16ae43fd8d66@linaro.org> <016dc073-c9a3-4b96-6c58-7b21e0f998a5@linaro.org> From: Daniel Lezcano In-Reply-To: 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 18:03, Rafael J. Wysocki wrote: > On Wed, Mar 29, 2023 at 5:59 PM Daniel Lezcano > wrote: >> >> On 29/03/2023 16:38, Rafael J. Wysocki wrote: >>> On Wed, Mar 29, 2023 at 4:16 PM Daniel Lezcano >>> wrote: >>>> >>>> On 29/03/2023 14:06, Rafael J. Wysocki wrote: >>>>> On Wed, Mar 29, 2023 at 11:57 AM Daniel Lezcano >>>>> wrote: >>>>>> >>>>>> 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 >>>>>>> --- >>>>>>> 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. >>>>>> >>>>>> Actually it reverts the work done to encapsulate the thermal zone device >>>>>> structure. >>>>> >>>>> So maybe instead of the wholesale switch to using "driver-specific" >>>>> device pointers for printing messages, something like >>>>> thermal_zone_debug/info/warn/error() taking a thermal zone pointer as >>>>> the first argument can be defined? >>>>> >>>>> At least this particular bug could be avoided this way. >>>> >>>> Actually we previously said the thermal_hwmon can be considered as part >>>> of the thermal core code, so we can keep using tz->device. >>>> >>>> I'll drop this change from the series. >>> >>> But it's there in my thermal branch already. >>> >>> Do you want to revert the thermal_hwmon.c part of commit dec07d399cc8? >> >> Oh, right. Fair enough. >> >> I think Rui's patch is fine then. > > I guess you mean the $subject one, that is: > > https://patchwork.kernel.org/project/linux-pm/patch/20230329090055.7537-1-rui.zhang@intel.com Correct > What about the message printed when temp is NULL. Should the original > form of it be restored too? Yes, you are right, for the sake of consistency we should restore also this one. -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog