From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Cc: error27@gmail.com, Peter Huewe <peterhuewe@gmx.de>,
Jarkko Sakkinen <jarkko@kernel.org>,
Jason Gunthorpe <jgg@ziepe.ca>,
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()
Date: Tue, 21 Mar 2023 09:01:08 +0100 [thread overview]
Message-ID: <ZBlkRCWAJXWkTQI2@kroah.com> (raw)
In-Reply-To: <20230321061416.626561-1-harshit.m.mogalapalli@oracle.com>
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 <harshit.m.mogalapalli@oracle.com>
> ---
> 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.
greg k-h
next prev parent reply other threads:[~2023-03-21 8:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-21 6:14 [PATCH next] tpm: Fix a possible dereference of ERR_PTR in tpm_init() Harshit Mogalapalli
2023-03-21 8:01 ` Greg Kroah-Hartman [this message]
2023-03-29 21:59 ` Jarkko Sakkinen
2023-03-29 21:59 ` Jarkko Sakkinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZBlkRCWAJXWkTQI2@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=error27@gmail.com \
--cc=harshit.m.mogalapalli@oracle.com \
--cc=jarkko@kernel.org \
--cc=jgg@ziepe.ca \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterhuewe@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox