From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C3C0C433F5 for ; Wed, 6 Oct 2021 09:40:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0E7C1610E5 for ; Wed, 6 Oct 2021 09:40:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237833AbhJFJlz (ORCPT ); Wed, 6 Oct 2021 05:41:55 -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-Google-Smtp-Source: ABdhPJxGYgn9BzjANB+d9fA29bz3DBw2Zage6bi9uAkkHwPusS7iJfx3UOVWBqimn8dOJYmXd8rnkQ== 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