From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
To: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: Peter Huewe <peterhuewe@gmx.de>,
Ashley Lai <ashley@ashleylai.com>,
Marcel Selhorst <tpmdd@selhorst.net>,
linux-api@vger.kernel.org, tpmdd-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [tpmdd-devel] [PATCH v2 2/7] tpm: two-phase chip management functions
Date: Tue, 7 Oct 2014 16:34:42 -0600 [thread overview]
Message-ID: <20141007223442.GA3014@obsidianresearch.com> (raw)
In-Reply-To: <20141007222814.GA7262@intel.com>
On Wed, Oct 08, 2014 at 01:28:14AM +0300, Jarkko Sakkinen wrote:
> > > @@ -714,15 +709,10 @@ static int tpm_tis_i2c_remove(struct i2c_client *client)
> > > struct tpm_chip *chip = tpm_dev.chip;
> > > release_locality(chip, chip->vendor.locality, 1);
> > >
> > > - /* close file handles */
> > > - tpm_dev_vendor_release(chip);
> > > -
> > > /* remove hardware */
> > > tpm_remove_hardware(chip->dev);
> >
> > Wrong ordering here, tpm_remove_hardware should always be first -
> > drivers should not tear down internal state before calling it, so
> > release_locality should be second.
> >
> > Noting that since we use devm the kfree will not happen until
> > remove returns, so the chip pointer is still valid.
>
> Should I fix this ordering? I was thinking to focus putting proper
> patterns in place only in tpm_tis and tpm_crb because they are the
> that I'm able to test easily and then they can work as guideline for
> other drivers.
I think since this patch is already touching this function there is
no reason not to make it be correct (especially since it was noticed)
The rest can wait till we globally replace tpm_remove_hardware with
tpm_unregister - at that time the ordering can be audited and
checked.
Then the drivers will be clean and the core can finally be fixed.
Jason
next prev parent reply other threads:[~2014-10-07 22:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-07 17:01 [PATCH v2 0/7] TPM 2.0 support Jarkko Sakkinen
2014-10-07 17:01 ` [PATCH v2 1/7] tpm: merge duplicate transmit_cmd() functions Jarkko Sakkinen
2014-10-07 17:01 ` [PATCH v2 2/7] tpm: two-phase chip management functions Jarkko Sakkinen
2014-10-07 17:50 ` [tpmdd-devel] " Jason Gunthorpe
2014-10-07 18:04 ` Jarkko Sakkinen
2014-10-07 18:27 ` Jason Gunthorpe
2014-10-07 19:15 ` Jarkko Sakkinen
2014-10-07 22:28 ` Jarkko Sakkinen
2014-10-07 22:34 ` Jason Gunthorpe [this message]
2014-10-09 9:07 ` Jarkko Sakkinen
2014-10-07 17:01 ` [PATCH v2 3/7] tpm: clean up tpm_tis driver life-cycle Jarkko Sakkinen
2014-10-07 17:53 ` [tpmdd-devel] " Jason Gunthorpe
2014-10-07 17:01 ` [PATCH v2 4/7] tpm: TPM 2.0 commands Jarkko Sakkinen
2014-10-07 17:01 ` [PATCH v2 5/7] tpm: TPM 2.0 sysfs attributes Jarkko Sakkinen
2014-10-07 17:01 ` [PATCH v2 6/7] tpm: TPM 2.0 CRB Interface Jarkko Sakkinen
2014-10-07 17:54 ` [tpmdd-devel] " Jason Gunthorpe
2014-10-07 17:01 ` [PATCH v2 7/7] tpm: TPM 2.0 FIFO Interface 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=20141007223442.GA3014@obsidianresearch.com \
--to=jgunthorpe@obsidianresearch.com \
--cc=ashley@ashleylai.com \
--cc=jarkko.sakkinen@linux.intel.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterhuewe@gmx.de \
--cc=tpmdd-devel@lists.sourceforge.net \
--cc=tpmdd@selhorst.net \
/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).