Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp651523rwl; Wed, 29 Mar 2023 06:54:41 -0700 (PDT) X-Google-Smtp-Source: AKy350b/TWQ0XI9OwXY2LeFfmTWXQg4AFmCuXsKpUmsWWJa5DbaZKY1+Ki4Y0Xhu+9YE/P5UXYzk X-Received: by 2002:a17:90a:e644:b0:23f:7176:df36 with SMTP id ep4-20020a17090ae64400b0023f7176df36mr21337438pjb.13.1680098081266; Wed, 29 Mar 2023 06:54:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680098081; cv=none; d=google.com; s=arc-20160816; b=q0yjTfdaqebrTTcdvlGTpijbfR9NQzck0/jdM4dBh6v7HNHh1VTpkq49VMlgYCEes+ Z3reO6wEnFTtVpb0tak1eKbvyg7JgtXJGXMtbi3ijAyWeyte2oaTeFHEL9oKMlvqM7En 4aUpmE8cCItA3d1eINw2gCPJuGZtguXVFiMAB81mW+MjOj5Bsb0iCDP/8UKScqz5w/L7 aGqWb9l21NuBBX5b9Qqe4mgLaNA+SUbKFc/ffUb5yzWLC05yObIXt/G24lcwnspveuN4 Mq8EzZqX8herZCQJspZTRuLucLJIBfoJ8P3nXacKNyj9NdJTxkBrWZ4TO9BUBaase+Zd zWzg== 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=EYsd/Ik0VeGNNfon6g+W4Knz9J9NyFcKGFAZeYDfLWw=; b=sFby2Kn4iH7In+57WCLNDyZ/jj1iPGCW9ecUHltdo0O4gj7j7TasicpFkgXy5szUF8 rTcwVFadvrE9uonSSunLkkp4hhjf+ckQbxUf8S0nnXnkXpS5q7uyi8HltxiNvhDVGpcK Q1QU8PQgJGr46TM1kpNPP8CIStKPHZZnUBOX1a3/t/I/79WZjy0Ai7lIOuQCgSBIFHZW MBjnenCzlRXxdosmCFt4e5HMTnITBBUKxTnuu0tzjdJ1LpFo9w/3kZwLzqjuciHdVS1w lOknnAIr7GGd/28xmW+mdVXc0bqFRXvFpYxDP2F6WvOonoyCdgffaw5DUtdTei36hdBZ 7XnQ== 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 e8-20020a17090ac20800b0023d3bef833csi1491858pjt.132.2023.03.29.06.54.28; Wed, 29 Mar 2023 06:54:41 -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 S229938AbjC2Num convert rfc822-to-8bit (ORCPT + 99 others); Wed, 29 Mar 2023 09:50:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbjC2Nul (ORCPT ); Wed, 29 Mar 2023 09:50:41 -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 BC100C2; Wed, 29 Mar 2023 06:50:40 -0700 (PDT) Received: by mail-ed1-f41.google.com with SMTP id ek18so63606940edb.6; Wed, 29 Mar 2023 06:50:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680097839; 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=KSXMakJnjZQBLG/2PdmHswzR68mf+sNeD11KjDBCsa4=; b=niQMs2PjwJB1x1kYhWJYK0yDZxqBsYDN3WTBs9mDtIMvBRwLa8Sx48pNHU9zZg6+e2 lV9oS7mTUiKe9bACShpl3Vm9jCFR5Qul4iyA/+FvmaCYF8iEUzmNTMzlp2y9om+tZm9M HNQr94wONSNWeCpgqz4y5qFJClLXhsBuH0J24wa4PtR04T1Sa/GJ7EZJ10ircwDKqjg9 +9nXIrB54NDr0/+eGAxFusaWm9TZMk8sFnPbOcZBIP+mDL7iVYx26jnwlAGb/faeXz5M ADPvT49dL+SwppxHzgP7ltNfaHw8nhkR+WBim2HtKOq+SpzQxreZTg0Y9SQ+IeTB521K heYw== X-Gm-Message-State: AAQBX9cMpa6MMgcAwgM/PZLSBrdmuKACb+crnXkIYDfXmeTYarAXVE+E WczsjIve6tNRRVkucwbZBORIAH+tyPoYjRjdI4M= X-Received: by 2002:a17:907:d48d:b0:93e:c1ab:ae67 with SMTP id vj13-20020a170907d48d00b0093ec1abae67mr8837859ejc.2.1680097839114; Wed, 29 Mar 2023 06:50:39 -0700 (PDT) MIME-Version: 1.0 References: <20230329090055.7537-1-rui.zhang@intel.com> <08aee7fe-eddc-7841-2539-16ae43fd8d66@linaro.org> <669e0114830d6e70e6fbc877c94de7446a239055.camel@intel.com> In-Reply-To: <669e0114830d6e70e6fbc877c94de7446a239055.camel@intel.com> From: "Rafael J. Wysocki" Date: Wed, 29 Mar 2023 15:50:27 +0200 Message-ID: Subject: Re: [PATCH -next] thermal/drivers/thermal_hwmon: Fix a kernel NULL pointer dereference To: "Zhang, Rui" Cc: "rafael@kernel.org" , "daniel.lezcano@linaro.org" , "linux-pm@vger.kernel.org" , "Wysocki, Rafael J" , "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 2:33 PM Zhang, Rui wrote: > > On Wed, 2023-03-29 at 14:06 +0200, 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. > > I didn't see your email before sending patch v2. > > are we going to rework the previous series from Daniel thus patch v2 is > no longer needed? Well, let's see what Daniel says.. In any case, though, it is not very useful to carry an obvious NULL pointer dereference in linux-next and the pr_debug() statement added by the v2 can be replaced later, so I think I'll apply it.