Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp183296pxb; Wed, 6 Oct 2021 02:42:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+mEF46tm19OUcwVQo65RuceoZM8K9hTQdh+I/Pt4u37oRC/btuUd/HtCRxLNvasWVufma X-Received: by 2002:a17:906:3d22:: with SMTP id l2mr15800911ejf.187.1633513321502; Wed, 06 Oct 2021 02:42:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633513321; cv=none; d=google.com; s=arc-20160816; b=0iu0Jvi1pgnWaW+xg73dUKys1Kc9yg5rn/TOzCRxxxBPv28ae6iFSDTdX+xgVkS2dW xf/3Mt/H1iIKwXP9JMrXaxRJ3TxaZbBeflwgrZKqJRWEChfD2r1QalG1TTepQujLICG7 PydLlZTjoOL0Yey/oe4/HtGrSCdmnMAVVlOARwUvFrymsfP7YeiKv8NTjOF6Q7vg/+rt dBnUEyWWRJnWItcgWiY6f4UhwHsFtXYbrlBB3Xtd4D1sthXqlM1xpFdWEPEmaUWN+v7s flPztYb+SCGD/EYl4QY6jtHpI6bMp1fbuTCjFnX45TdvQN4BeuIJWT7OP1VBaIJFh379 UBIQ== 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=ZM0aAVFYc0rlVYzXR6lOn7gapiy86clYgqFzWRzZRQM=; b=0iQlWQbfEOKaQ72wL84cdSC8pj6Rxazi1MguC/irQauwgVWpvai16eJb3HT9mr7jUu A4SdBXETFOjwCBacb0GO1pa5rwmg7gZbcu3JKXcfXyn1n59ID10elb9Ni/2qvyeZmgNx TFknFQSi2BWJc101DMv/dv9j7Kk68ec2g0HlJwGeFAIqXV0pPykus75BtTj2kr+Tyjyh ApE7sM6wIXvdraqD/0MhpBmh7xhlrtEUxiiwBdOBCARp2hO+rJAaojMGu0wB+dZmFjk4 FKyJcx1PWrp7PxW3TFYwqNyxRrXkgQTak+/7JGfC2p3PA9sy6OJ+zFFEDdQytriqPr9f LCKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fC5Jwc7v; 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 s18si26303156eji.59.2021.10.06.02.41.37; Wed, 06 Oct 2021 02:42:01 -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=fC5Jwc7v; 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 S237766AbhJFJly (ORCPT + 99 others); Wed, 6 Oct 2021 05:41:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230131AbhJFJlx (ORCPT ); Wed, 6 Oct 2021 05:41:53 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BBC6C06174E for ; Wed, 6 Oct 2021 02:40:01 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id t2so6893909wrb.8 for ; Wed, 06 Oct 2021 02:40:01 -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=ZM0aAVFYc0rlVYzXR6lOn7gapiy86clYgqFzWRzZRQM=; b=fC5Jwc7vl2j0wd07nXEcPOs5huHXlNmaWEKKt0tHPFuuReV5LClasR//BkXBScnHrM q6iNasUf4x6wgxMNTTuRqtnLnKfMKCPK059UT/EuwjVn56CdUL30oLwJsRWFwwhN7pF9 wmX31Mp5m8jtCAif8OmBIKuA1olg6pPiC4whbfoOi+CpRpkS0oVI80l+OB947XIfnInW G3p7mklqYIPFJMUzjYto553mN4v/INi6kjV0mh6Z7kbRr3zD5PZjez15P4/eIO900Csy sRE+OBTAthgjJY8OUYgbmvA1wvII7jwjjBkblWfTleShhl/mKWVzhQjYNGYfrPeigrXQ dX1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=ZM0aAVFYc0rlVYzXR6lOn7gapiy86clYgqFzWRzZRQM=; b=tgnY0u5U9TfZn7WO7pPaQlQ3zCaAyZoA9LnClN+I9cSlOXdvkSDtQWSIlnPCrWmh16 MOwyp8ASm3A3vU1QWNxe7lJMGm2Tr6Wpr7d1gyA+aTSjqwTL35AZwSkY3pJMY1+KJWhF g9DFJAe5hIve1O54B0n8GSKqM+tSIY6fS24nOIqOpgNmOe74mu9YZEQh6OwVvv5nrBn5 uTxrJZQM/zI5EvLsdBVA+hTcf6DcS7r09llFjBcle2C8tCKFhUr7Oh23nX9hzexn+7l8 ch3d96GYGpK2sGnjvDlCTO5LFD4AVvY1GBC3Lfc+yxvoWtOM+HY1iL3GNDooRPkXy0Bx mCPQ== X-Gm-Message-State: AOAM532r7XbmDGFPkuSDtCuh6qjdllLP1b3+HZghAipP1t19ITwNDnAn bCWR1mbUW+l5Aa0I2BdzG+rSYA== X-Received: by 2002:a05:600c:4101:: with SMTP id j1mr96789wmi.66.1633513199392; Wed, 06 Oct 2021 02:39:59 -0700 (PDT) Received: from ?IPv6:2a01:e34:ed2f:f020:278:1f59:2992:87fe? ([2a01:e34:ed2f:f020:278:1f59:2992:87fe]) by smtp.googlemail.com with ESMTPSA id u24sm4454538wmj.48.2021.10.06.02.39.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 Oct 2021 02:39:58 -0700 (PDT) Subject: Re: [PATCH v2] thermal: Fix a NULL pointer dereference To: Subbaraman Narayanamurthy , Zhang Rui , Amit Kucheria Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, David Collins , Manaf Meethalavalappu Pallikunhi , Ram Chandrasekar , stable@vger.kernel.org References: <1631041289-11804-1-git-send-email-quic_subbaram@quicinc.com> <55999619-22c7-63fd-7006-f91f144e4a60@linaro.org> <7930989e-baf1-04f4-59ad-d65122149b9b@quicinc.com> From: Daniel Lezcano Message-ID: Date: Wed, 6 Oct 2021 11:39:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: 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 06/10/2021 00:09, Subbaraman Narayanamurthy wrote: [ ... ] >>> The tests can be replaced by (!data->ops), no ? >> Thanks Daniel for reviewing the patch. >> >> I agree that even if a sensor module is unregistered, that would call >> "thermal_zone_of_sensor_unregister" which would eventually set NULL on >> get_temp() and get_trend() and "tzd->ops" as well. >> >> However, of_thermal_get_temp() is trying to call "data->ops->get_temp" >> which comes from a sensor driver when it registers. There is no >> guarantee that it would be non-NULL right? >> >> Thinking of which, I think having both checks would be valid. > > Hi Daniel, > Do you still have any concerns with this change? Yes, let me answer to the initial patch. -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog