linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Stefan Berger <stefanb@linux.ibm.com>
Cc: Tyrel Datwyler <tyreld@linux.ibm.com>,
	jarkko@kernel.org, peterhuewe@gmx.de,
	linux-integrity@vger.kernel.org, Korrapati.Likhitha@ibm.com,
	pavrampu@in.ibm.com, linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org, gcwilson@us.ibm.com,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] tpm: Fix kexec crash due to access to ops NULL pointer (powerpc)
Date: Mon, 20 Dec 2021 21:13:20 -0400	[thread overview]
Message-ID: <20211221011320.GM6467@ziepe.ca> (raw)
In-Reply-To: <d9eafa8f-4006-4bc2-c09b-6b02a14c6ef3@linux.ibm.com>

On Mon, Dec 20, 2021 at 08:05:58PM -0500, Stefan Berger wrote:

> diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
> index ddaeceb7e109..4cb908349b31 100644
> +++ b/drivers/char/tpm/tpm-chip.c
> @@ -473,15 +473,8 @@ static void tpm_del_char_device(struct tpm_chip *chip)
>         mutex_unlock(&idr_lock);
> 
>         /* Make the driver uncallable. */
> -       down_write(&chip->ops_sem);
> -       if (chip->flags & TPM_CHIP_FLAG_TPM2) {
> -               if (!tpm_chip_start(chip)) {
> -                       tpm2_shutdown(chip, TPM2_SU_CLEAR);
> -                       tpm_chip_stop(chip);
> -               }
> -       }
> -       chip->ops = NULL;
> -       up_write(&chip->ops_sem);
> +       if (chip->ops)

ops cannot be read without locking

Jason

  reply	other threads:[~2021-12-21  1:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-12  1:28 [PATCH] tpm: Fix kexec crash due to access to ops NULL pointer (powerpc) Stefan Berger
2021-12-20  5:17 ` Sachin Sant
2021-12-21  0:39 ` Tyrel Datwyler
2021-12-21  1:05   ` Stefan Berger
2021-12-21  1:13     ` Jason Gunthorpe [this message]
2021-12-21  1:31       ` Stefan Berger
2021-12-21  1:37         ` Tyrel Datwyler
2021-12-21  1:34     ` Tyrel Datwyler
2021-12-21  8:47 ` Jarkko Sakkinen
2021-12-21 14:01   ` Stefan Berger
2021-12-21 14:17     ` Stefan Berger
2021-12-29  0:10     ` 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=20211221011320.GM6467@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=Korrapati.Likhitha@ibm.com \
    --cc=gcwilson@us.ibm.com \
    --cc=jarkko@kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=pavrampu@in.ibm.com \
    --cc=peterhuewe@gmx.de \
    --cc=stefanb@linux.ibm.com \
    --cc=tyreld@linux.ibm.com \
    /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;
as well as URLs for NNTP newsgroup(s).