Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp925327rwl; Wed, 29 Mar 2023 10:08:26 -0700 (PDT) X-Google-Smtp-Source: AKy350ZTtBcXpGrQR4pv7qDywuIeZ36greLJM2hbhj3VrC1LEjBz1gdUh5xN5+snZn58ZBHG/+t6 X-Received: by 2002:aa7:c74d:0:b0:4ac:bbaa:867a with SMTP id c13-20020aa7c74d000000b004acbbaa867amr17542825eds.24.1680109706508; Wed, 29 Mar 2023 10:08:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680109706; cv=none; d=google.com; s=arc-20160816; b=nS+Wqiv+pFBhqAk20PCTEKF9mpUZ3qGzxtpe1J1rF0A185ofl8HOtZ3pdZnVZ5Ee+Z 6tp4i8ZsL3bHOgKvn/sIBMEo4A1NM1g1eKBeRB2SQC3zNLK3fflUoGNCVSeUbIdO70aw flREhVCgpUXVccdO1B6bEqvqtn4RL3WuJ1h31j/yRR8H366U6iGOmkr0L2Yq1t50VfU2 bNXHLSnLvsKK+pVJw6hFQA9PWorWQD8/K4PN9EjOUelJdr//WPvkcfeSs/WjyBbI85ud T4m7egzSTEhfgLSOmNJkQ6JQFOPAf4q2U3v9HrswSaAcwxDaqJH9rbbHhW7cO31qENd5 YBOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=V32N3Tpyk3T+9JaQzWlQstTBiq+AphqBmxXRvi22Yc4=; b=rcOskh6FJ8iOWOo00vo8D2Lh0eZoUgFBVhSpY5Gr20hhIUI/hFgUDy/nC8ojPPqjMx O8MaoaosgyHa6DaS9Ga1gwyaHCWU3tRH5LN2LcvEBmLERc2kMgWtHO5886GUbX9jgYxq naxT2/WE/aBo2jAk08kDUVWCFczHBL9YOAtgi0aG/+ZXMzdmZ0LTiM1HNPd59j53G/TI aVjEqHDLWZR32HVlWgmZ7LTpM7qvKW8HgBihGMm2aym3y0tOusCZBLLOj2UHXCZijN+j A5GJhowG5ENDBx6JW0D5Z9wweSju2Qw7wVlLQV+8HnPGmoQLrqVBSPcYLI4BlLJMI9Vv i7MQ== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s4-20020a1709060c0400b0093349208719si26576542ejf.768.2023.03.29.10.07.46; Wed, 29 Mar 2023 10:08:26 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230473AbjC2RFl convert rfc822-to-8bit (ORCPT + 99 others); Wed, 29 Mar 2023 13:05:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229638AbjC2RFi (ORCPT ); Wed, 29 Mar 2023 13:05:38 -0400 Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0D6230C2; Wed, 29 Mar 2023 10:05:37 -0700 (PDT) Received: by mail-ed1-f41.google.com with SMTP id ew6so66054812edb.7; Wed, 29 Mar 2023 10:05:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680109536; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=62e4+lmBq/lhs+cZOFYzhKCQ2kaGBP2Gx8PsA2GJi24=; b=brwTXAhpSqTEZUTTq2fbdAOQgP2fNMAkrmXFGqBFPZvgUtoV1PaGW3Du4zTljiTFKq N9DMw3kUENKj2MHsqhBn2YgWGanXtLgNwGHJudL8pvy6Jv98YYsOF4pP2oQ/p5QA8fZN hK/g/OZqVXkBarjZHKozBlBwZ/RMiSPv7Ymfo7LEMPLry7wd+mXNNiZxN6eledtMgJU+ 0aYPT+cKYzfGbapbk/6Vk5hMTLWnagjgoAswIBFvAeJ42XogID7gAbP7SYynmvFE/g9Q uN3S+V5oG4pDvGWfXEIsdBKP1pSTlXjXmBUkmsC8OPMse/OeMvu9bRS9BjqFwLasY4KA vDUA== X-Gm-Message-State: AAQBX9d/zrUAnNeI3v2IObhpku0I7pfKwrzVp5WIJisnWoXNZ5CZ2cd+ tUoUjGP8FOXMWPppL4I9GseXixie03d2Ip/pkNFWHGYG X-Received: by 2002:a17:907:160e:b0:946:a095:b314 with SMTP id hb14-20020a170907160e00b00946a095b314mr3933611ejc.2.1680109536322; Wed, 29 Mar 2023 10:05:36 -0700 (PDT) MIME-Version: 1.0 References: <20230329090055.7537-1-rui.zhang@intel.com> <77da9d68-3cb2-f765-21d2-e427776dca44@linaro.org> In-Reply-To: <77da9d68-3cb2-f765-21d2-e427776dca44@linaro.org> From: "Rafael J. Wysocki" Date: Wed, 29 Mar 2023 19:05:25 +0200 Message-ID: Subject: Re: [PATCH -next] thermal/drivers/thermal_hwmon: Fix a kernel NULL pointer dereference To: Daniel Lezcano , Zhang Rui Cc: linux-pm@vger.kernel.org, rafael.j.wysocki@intel.com, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=0.5 required=5.0 tests=FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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 Wed, Mar 29, 2023 at 6:03 PM 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 > > Acked-by: Daniel Lezcano Applied, thanks! > > --- > > 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 >