Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1253815rwl; Wed, 29 Mar 2023 15:08:57 -0700 (PDT) X-Google-Smtp-Source: AKy350b+oLfLRR2N4EzQftiPPh/MjBgeknf9hyk+qzodadA3y2iQ54GKOT1wuGiatPAuQerQS3xx X-Received: by 2002:a62:38cb:0:b0:626:7c4:9f38 with SMTP id f194-20020a6238cb000000b0062607c49f38mr19330101pfa.31.1680127737034; Wed, 29 Mar 2023 15:08:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680127737; cv=none; d=google.com; s=arc-20160816; b=AsEkWfNV2Baby/3SVJtnC+nC40NakU0WFqriMWQYKEwb9E1g/2MBpdyqOa/wBWwot5 /Q4nDYR3wGobDeRlIaMElrEyCVSLlQf7iDGqsIYE285eJwqph/xrjmLo4t0SIMd5doJp vXQy3icoB5aU1zhBH1kR2ksVAIJLIVlG+8UFRKZQSjzVsXg0doUHAGXS91sZZ0h+qAYr XZf5+qEIvQvm3qeW/dnuD4Mqlm3M0xj14+0tHB9/lCxWJcuZG2bfSmYjImrkx6zb5APW cZ06/rjKwlQHVNokHXUs8Z7BpVAohlGweE8LtoDoSbFe6LoiH8EGm6PS2A/lQ9UZntQT zr9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=LuUClYwGTgbN4AI76cIGKWYFM4p33qSLG+tdBrUyRWQ=; b=eumuJEJIblXHW9WV5X9fqYeDY7YSKbelu/4rwRU+qFXmbPG6mXXOmK5NBLh6rCsiYI 6uCmcmvlIEojpdsvwXSCGzd59aW55DnqhI7ZkrgiwTmNo7JyoKDNNFMxtlgjELd/HKYK e2b/NovJUPd103ssqSg+aqras30N3ykW/HAwHHld/ItDmio6ZvBv/9cN7WEwEDEWvsTz eVamVoEodJdRhSeH5oMPdfHvoDlst6aajyoUNiqnlAjfxIUzo9nCZWX0ZlFHwoh4HlH1 Mx0SXxAA9eRU19STgvw19jtW/I9t51orpji9uzv0lKNyiCRta7kHHTYJuGr+Kz8tPMH3 dT3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=THFI3avC; 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 w4-20020a656944000000b0051309268f00si15535708pgq.449.2023.03.29.15.08.42; Wed, 29 Mar 2023 15:08:57 -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=@kernel.org header.s=k20201202 header.b=THFI3avC; 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 S229959AbjC2V73 (ORCPT + 99 others); Wed, 29 Mar 2023 17:59:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230114AbjC2V71 (ORCPT ); Wed, 29 Mar 2023 17:59:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 005A34229; Wed, 29 Mar 2023 14:59:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 557F6B820F8; Wed, 29 Mar 2023 21:59:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C092DC433EF; Wed, 29 Mar 2023 21:59:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680127164; bh=ljDaLKLthqQnKDSNdw368P4iGOmyLBXnc7NxO3F9wm8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=THFI3avC4d9jZ2EOJjI+Iv6P7SEFAN2y+jTf1Lr7P1jpNbAJz+08OZDGZmwJ2nBsR O47mz4jGQi2Xqypd5JaAEXzexGycAUDNwV6cB2qbc0DwR54/xyhdDIwY0+UbWkVOOi 4GrEWaXphePpfN8HwwqUyTkvcVCHkVXh51sTR+ZK7MiZKAOuEbcLmOZOv+szbizIln U+6iP43VB17Qg9T1qYL3SdChwbAWxCrxceSeGw7F/HdZEaqEAwu2B+2a3BMxGbrsI+ wqrprCPj5pC3lwIOLpXbEgL67ePRRruye2JEylrtTiLrwWCQRoPb/af61tAIetMf+C 99WnMexCSCIvA== Date: Thu, 30 Mar 2023 00:59:21 +0300 From: Jarkko Sakkinen To: Greg Kroah-Hartman Cc: Harshit Mogalapalli , error27@gmail.com, Peter Huewe , Jason Gunthorpe , linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH next] tpm: Fix a possible dereference of ERR_PTR in tpm_init() Message-ID: <20230329215921.2yjebtrscuo66km2@kernel.org> References: <20230321061416.626561-1-harshit.m.mogalapalli@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,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 Tue, Mar 21, 2023 at 09:01:08AM +0100, Greg Kroah-Hartman wrote: > On Mon, Mar 20, 2023 at 11:14:15PM -0700, Harshit Mogalapalli wrote: > > Smatch reports: > > drivers/char/tpm/tpm-interface.c:470 tpm_init() error: > > 'tpm_class' dereferencing possible ERR_PTR() > > > > If class_create() returns error pointer, we are dereferencing a possible > > error pointer. Fix this by moving the dereference post error handling. > > > > Fixes: a010eb881243 ("tpm: fix up the tpm_class shutdown_pre pointer when created") > > Signed-off-by: Harshit Mogalapalli > > --- > > This is based on static analysis, only compile tested. > > Thanks for this, good catch, I've queued it up in my tree now as I have > the offending change that caused this. OK, thank you! BR, Jarkko