linux-integrity.vger.kernel.org archive mirror
 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, 23 Jul 2020 04:56:19 +0300	[thread overview]
Message-ID: <20200723015619.GF45081@linux.intel.com> (raw)
In-Reply-To: <CABXOdTd4oY8TpuE1qZP--dYTJ-czdovsjmhLVbd_tTw=sApHYw@mail.gmail.com>

On Thu, Jul 16, 2020 at 10:38:00AM -0700, Guenter Roeck wrote:
> On Thu, Jul 16, 2020 at 10:28 AM Jarkko Sakkinen
> <jarkko.sakkinen@linux.intel.com> wrote:
> >
> > 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?
> >
> 
> I just had a quick look into linux-5.4.y, and it seemed to me that it
> is affected. Maybe I am wrong. Either case, we already applied this
> patch to all affected ChromeOS kernel branches, so from our
> perspective it doesn't really matter.
> 
> Thanks,
> Guenter

I'm fine with cc'ing stable after consideration given the benefits.

Given that conclusion, it is better to break this down to two part
series as you proposed.

/Jarkko

  reply	other threads:[~2020-07-23  1:56 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
2020-07-16 17:38           ` Guenter Roeck
2020-07-23  1:56             ` Jarkko Sakkinen [this message]
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=20200723015619.GF45081@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 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).