All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Guenter Roeck <groeck@google.com>
Cc: Andrey Pronin <apronin@chromium.org>,
	Peter Huewe <peterhuewe@gmx.de>, Jason Gunthorpe <jgg@ziepe.ca>,
	linux-integrity@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	Guenter Roeck <groeck@chromium.org>
Subject: Re: [PATCH] tpm: avoid accessing cleared ops during shutdown
Date: Thu, 16 Jul 2020 20:28:11 +0300	[thread overview]
Message-ID: <20200716172811.GB14135@linux.intel.com> (raw)
In-Reply-To: <CABXOdTcAZjG8aQvs+M72CFe9rAdBKZH+6x=C1Ha2aX_w0gXiHw@mail.gmail.com>

On Tue, Jul 14, 2020 at 08:48:38AM -0700, Guenter Roeck wrote:
> On Tue, Jul 14, 2020 at 4:32 AM Jarkko Sakkinen
> <jarkko.sakkinen@linux.intel.com> wrote:
> >
> > On Fri, Jul 10, 2020 at 11:25:44AM -0700, Andrey Pronin wrote:
> > > > Why does not tpm_del_char_device need this?
> > >
> > > "Not" is a typo in the sentence above, right? tpm_del_char_device *does*
> > > need the fix. When tpm_class_shutdown is called it sets chip->ops to
> > > NULL. If tpm_del_char_device is called after that, it doesn't check if
> > > chip->ops is NULL (normal kernel API and char device API calls go
> > > through tpm_try_get_ops, but tpm_del_char_device doesn't) and proceeds to
> > > call tpm2_shutdown(), which tries sending the command and dereferences
> > > chip->ops.
> >
> > It's a typo, yes. Sorry about that.
> >
> > tpm_class_shutdown() is essentially tail of tpm_del_char_device().
> >
> > To clean things up, I'd suggest dropping tpm_del_char_device() and
> > call tpm_class_shutdown() in tpm_chip_unregisters() along, and open
> > coding things that prepend it in tpm_del_char_device().
> >
> 
> Personally I would have preferred two separate patches, one to fix the
> immediate problem (with Cc: stable) and one for the cleanup, but I
> guess merging both into one is ok as long as it is marked for stable.
> 
> Thanks,
> Guenter

Not sure about stable as this issue does not afaik concern earlier
kernel versions?

/Jarkko

  reply	other threads:[~2020-07-16 17:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-10  0:22 [PATCH] tpm: avoid accessing cleared ops during shutdown Andrey Pronin
2020-07-10 11:40 ` Jarkko Sakkinen
2020-07-10 18:25   ` Andrey Pronin
2020-07-14 11:32     ` Jarkko Sakkinen
2020-07-14 15:48       ` Guenter Roeck
2020-07-16 17:28         ` Jarkko Sakkinen [this message]
2020-07-16 17:38           ` Guenter Roeck
2020-07-23  1:56             ` Jarkko Sakkinen
2020-07-10 19:08 ` James Bottomley
2020-07-10 20:34   ` Andrey Pronin

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=20200716172811.GB14135@linux.intel.com \
    --to=jarkko.sakkinen@linux.intel.com \
    --cc=apronin@chromium.org \
    --cc=groeck@chromium.org \
    --cc=groeck@google.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.